DynamoMTL / spree_chimpy

Spree/MailChimp Integration
BSD 3-Clause "New" or "Revised" License
35 stars 123 forks source link

`find_list_id': undefined method `detect' for nil:NilClass #37

Closed noff closed 10 years ago

noff commented 10 years ago

Using Spree 2.1 spree_chimpy last version from master branch.

Default config:

Spree::Chimpy.config do |config|
  # your API key as provided by MailChimp
  config.key = '...'

  # extra api options for the Mailchimp gem
  # config.api_options = { throws_exceptions: false, timeout: 3600 }

  # name of your list, defaults to "Members"
  # config.list_name = 'peeps'

  # Allow users to be subscribed by default. Defaults to false
  # If you enable this option, it's strongly advised that your enable
  # double_opt_in as well. Abusing this may cause Mailchimp to suspend your account.
  # config.subscribed_by_default = false

  # When double-opt is enabled, the user will receive an email
  # asking to confirm their subscription. Defaults to false
  # config.double_opt_in = false

  # id of your store. max 10 letters. defaults to "spree"
  config.store_id = 'GroceryMarket'

  # define a list of merge vars:
  # - key: a unique name that mail chimp uses. 10 letters max
  # - value: the name of any method on the user class.
  # default is {'EMAIL' => :email}
  # config.merge_vars = {
  #   'EMAIL' => :email,
  #   'HAIRCOLOR' => :hair_color
  # }
end

Disabled SSL verificatin (because error with api.mailchimp.com): OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

On start localhost, get error:

$ rails s
=> Booting Thin
=> Rails 4.0.2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[...]]/config/initializers/bypass_ssl.rb:1: warning: already initialized constant OpenSSL::SSL::VERIFY_PEER
Exiting
[...].rvm/gems/ruby-2.0.0-p451/bundler/gems/spree_chimpy-dfabef7e642f/lib/spree/chimpy/interface/list.rb:49:in `find_list_id': undefined method `detect' for nil:NilClass (NoMethodError)
    from [...].rvm/gems/ruby-2.0.0-p451/bundler/gems/spree_chimpy-dfabef7e642f/lib/spree/chimpy/interface/list.rb:53:in `list_id'
    from [...].rvm/gems/ruby-2.0.0-p451/bundler/gems/spree_chimpy-dfabef7e642f/lib/spree_chimpy.rb:47:in `list_exists?'
    from [...].rvm/gems/ruby-2.0.0-p451/bundler/gems/spree_chimpy-dfabef7e642f/lib/spree_chimpy.rb:80:in `ensure_list'
    from [...].rvm/gems/ruby-2.0.0-p451/bundler/gems/spree_chimpy-dfabef7e642f/lib/spree/chimpy/engine.rb:15:in `block in <class:Engine>'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
    from [...].rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
    from [...].rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
    from [...].rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
    from [...].rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
    from [...].rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:180:in `each'
    from [...].rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
    from [...].rvm/rubies/ruby-2.0.0-p451/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from [...]Projects/[...]/config/environment.rb:5:in `<top (required)>'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
    from [...]Projects/[...]/config.ru:3:in `block in <main>'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
    from [...]Projects/[...]/config.ru:in `new'
    from [...]Projects/[...]/config.ru:in `<main>'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/commands/server.rb:48:in `app'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/commands/server.rb:75:in `start'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/commands.rb:76:in `block in <top (required)>'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
    from [...].rvm/gems/ruby-2.0.0-p451/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'
braidn commented 10 years ago

Does the user's account have more than 25 lists?

noff commented 10 years ago

Only 3. I found it was because gem couldn't connect to API because it can't correctly map to datacenter. It was because API key was without suffix -us3 (just copied from Mailchimp page). After I added "...-us3" suffix all start to work. I think it is better to write it into documentation.