andrusha / middleman-cloudfront

An Amazon CloudFront extension for middleman which allows you to invalidate CloudFront CDN cache
MIT License
58 stars 29 forks source link

Uses configure :development block #9

Closed tmaier closed 10 years ago

tmaier commented 10 years ago

When I run invalidate after build, I get the following error message

       ## Invalidating files on CloudFront
       == Unknown Extension: livereload
       == Locales: de (Default de)
       == Unknown Extension: livereload
       == Locales: de (Default de)
       == Unknown Extension: livereload
       == Locales: de (Default de)
       == Unknown Extension: livereload
       == Locales: de (Default de)
x       Invalidating 252 files. It might take 10 to 15 minutes until all files are invalidated.
       Please check the AWS Management Console to see the status of the invalidation.

livereload is unknown, as I have it in the development group of my Gemfile. At least when I run invalidate with middleman build it should respect the :build block and ignore the :development block. Second, I wonder why it tries to load the configuration four times.

An excerpt of my config.rb

if ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'] && ENV['AWS_CF_DISTRIBUTION_ID']
  activate :cloudfront do |cf|
    cf.access_key_id = ENV['AWS_ACCESS_KEY_ID']
    cf.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
    cf.distribution_id = ENV['AWS_CF_DISTRIBUTION_ID']
    cf.after_build = true
  end
end

configure :development do
  # Reload the browser automatically whenever files change
  activate :livereload,
           no_swf: true
  config[:file_watcher_ignore] += [%r{\.idea/}]

  activate :google_analytics do |ga|
    ga.tracking_id = false
  end
end

# Build-specific configuration
configure :build do
  # ...
end
andrusha commented 10 years ago

Hey Tobias!

Thanks for the bug report, could you say what version of middleman (and other gems) you’re using? I’ve wrote middleman-cloudfront quite awhile ago and it might be the compatibility problem.

On Monday, April 28, 2014 at 15:41, Tobias L. Maier wrote:

When I run invalidate after build, I get the following error message

Invalidating files on CloudFront == Unknown Extension: livereload == Locales: de (Default de) == Unknown Extension: livereload == Locales: de (Default de) == Unknown Extension: livereload == Locales: de (Default de) == Unknown Extension: livereload == Locales: de (Default de) x Invalidating 252 files. It might take 10 to 15 minutes until all files are invalidated. Please check the AWS Management Console to see the status of the invalidation.

livereload is unknown, as I have it in the development group of my Gemfile. At least when I run invalidate with middleman build it should respect the :build block and ignore the :development block. Second, I wonder why it tries to load the configuration four times.
An excerpt of my config.rb if ENV['AWS_ACCESS_KEY_ID'] && ENV['AWS_SECRET_ACCESS_KEY'] && ENV['AWS_CF_DISTRIBUTION_ID'] activate :cloudfront do |cf| cf.access_key_id = ENV['AWS_ACCESS_KEY_ID'] cf.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] cf.distribution_id = ENV['AWS_CF_DISTRIBUTION_ID'] cf.after_build = true end end configure :development do # Reload the browser automatically whenever files change activate :livereload, no_swf: true config[:file_watcher_ignore] += [%r{.idea/}] activate :google_analytics do |ga| ga.tracking_id = false end end # Build-specific configuration configure :build do # ... end

— Reply to this email directly or view it on GitHub (https://github.com/andrusha/middleman-cloudfront/issues/9).

tmaier commented 10 years ago
    middleman (3.2.2)
    middleman-blog (3.5.2)
    middleman-cloudfront (0.0.6)
    middleman-core (3.2.2)
jrunning commented 10 years ago

Any update on this, or a workaround? I'm having the same issue.

$ bundle list | grep middleman
  * middleman (3.3.2)
  * middleman-cloudfront (0.0.7)
  * middleman-core (3.3.2)
  * middleman-livereload (3.1.1)
  * middleman-sprockets (3.3.2)
manuelmeurer commented 10 years ago

Please try v0.0.8

jrunning commented 10 years ago

Thanks for the reply, @manuelmeurer. Unfortunately I'm having an issue with the middleman invalidate command now:

$ bundle list middleman-cloudfront
/Users/jordanrunning/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-cloudfront-0.0.8

$ AWS_SECRET_ACCESS_KEY=***** AWS_ACCESS_KEY_ID=***** CLOUDFRONT_DISTRIBUTION_ID=***** \ 
> bundle exec middleman invalidate
ERROR: "middleman invalidate" was called with no arguments
Usage: "middleman cloudfront:invalidate"

When I use middleman cloudfront:invalidate it says, "There is no 'cloudfront:invalidate' command for Middleman. Try 'middleman help' for a list of commands."

Thoughts?

manuelmeurer commented 10 years ago

Please try v0.0.9 :smile_cat:

tmaier commented 10 years ago
       ## Invalidating files on CloudFront
       Invalidating 253 files. It might take 10 to 15 minutes until all files are invalidated.
       Please check the AWS Management Console to see the status of the invalidation.

Seems like it's fixed. Closing it

tmaier commented 10 years ago

And thank you @manuelmeurer

manuelmeurer commented 10 years ago

Sure, no problem. I will yank v0.0.8.

jrunning commented 10 years ago

This has fixed the issue for me as well. Thanks for your attention!