drewblas / aws-ses

Provides an easy ruby DSL & interface to AWS SES
MIT License
549 stars 108 forks source link

`activate': undefined method `map' for nil:NilClass (NoMethodError) #9

Closed nodanaonlyzuul closed 13 years ago

nodanaonlyzuul commented 13 years ago

Apologies in advance if I am doing something stupid. I am trying to use aws-ses in a Rails 2.3.5 app using Ruby 1.8.7.

In my environment.rb I put config.gem "aws-ses"

config.after_initialize do
 ActionMailer::Base.delivery_method = :amazon_ses
 ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new(:secret_access_key => 'XXX', 
                                                                  :access_key_id => 'xxx')
 end

Where I get an error saying: activate': undefined methodmap' for nil:NilClass (NoMethodError)

This is the complete stacktrace - was wondering if anyone else has hit something similar

sshaw commented 13 years ago

Try: config.gem "aws-ses", :lib => "aws/ses"

nodanaonlyzuul commented 13 years ago

sshaw - many thanks.

I've poked around (unsuccessfully for now) and see the problem comes from the

 require 'mail' 

call that happens on the 1st line of ses.rb. If I just open a script/console session: require 'mail' gives me the same exception. In an irb session - things work fine.

I'll keep digging!

nodanaonlyzuul commented 13 years ago

Oooops. Didn't mean to close this issue.

sshaw commented 13 years ago

I suspect your problem could be that aws-ses depends on mail ~> 2.2.5 which depends on activesupport ~> 2.3.6.pre.

nodanaonlyzuul commented 13 years ago

Hi.

I got things running by venorizing aws/ses and mail (2.2.15) anddoing what's in the attached gist in my environment.rb.

It should be noted - the project is using config.gem not bundler.

https://gist.github.com/123e5aaa5ea10d326bd0

TinNT commented 13 years ago

phew, I wish I found this issue earlier.

I am running rails 2.3.5, ruby 1.8.7, I tried config.gem "aws-ses", :version => '0.4.1', :lib => 'aws/ses'

It did not work. (Missing these required gems: aws-ses = 0.4.1)

I uninstalled mail 2.2.15 then installed mail 2.2.5 => worked!

thanks.

tylermdunn commented 13 years ago

I am having the same issue but none of the above fixes it. I have tried: My environment:

  1. Rails 2.3.5
  2. Ruby 1.8.7
  3. Installed gems: aws-ses (0.4.2) activesupport (3.0.6, 2.3.5) mail (2.2.5) ... among others

My attempted fixes:

  1. Go from 'mail 2.2.15' to 'mail 2.2.5'
  2. Add this block, and variations of it to environment.rb in the config directory: config.gem "aws-ses", :version => '0.4.2', :lib => 'aws/ses' config.after_initialize do ActionMailer::Base.delivery_method = :amazon_ses ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new({ :access_key_id => 'my-access-key', :secret_access_key => 'my-secret-key' })

I have a few ideas of things to try, but I don't really know/think they would necessarily help:

  1. mail requires activesupport (>= 2.3.6), but I have 2.3.5 and 3.0.6. Does having two versions of this do something bad?
  2. Maybe I'm just not putting stuff in the right file?
  3. The official documentation says to put the line: gem "aws-ses", "~> 0.4.1", :require => 'aws/ses' in the Gemfile, but I don't know what that is. Is that the same this as the environment.rb file?

Can anyone think of anything that might help me? I am new to Rails, so most of my code is just copy-paste of what I have found online elsewhere.