Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pusher in Rails: "Unknown auth_key" - server side not triggering events

I am trying to insert Pusher into my already quite late stage Rails app. The client side works fine - using the Pusher Event Creator triggers the desired javascript. The server side is not working however:

Using the following code in my notifications controller create action to test:

Pusher.trigger('private-4','new_message', {:from => "christian", :subject => "hello"})

Gives this error:

Pusher::AuthenticationError (Unknown auth_key):
  app/controllers/notifications_controller.rb:57:in `block in create'
  app/controllers/notifications_controller.rb:38:in `create'

(and nothing new appears in the Debug Console)

I am running this in the development environment. I've tested the 'pusher/notify' sample app on my system and that works fine, both client and server.

in development.rb:

  # Pusher
  require 'pusher'

  Pusher.app_id = '{redacted}'
  Pusher.key    = '{redacted}'
  Pusher.secret = '{redacted}'

  Pusher.logger = Rails.logger

Update - full log output:

Unknown auth_key (Pusher::AuthenticationError)
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/pusher-0.11.3/lib/pusher/request.rb:99:in `handle_response'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/pusher-0.11.3/lib/pusher/request.rb:52:in `send_sync'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/pusher-0.11.3/lib/pusher/resource.rb:18:in `post'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/pusher-0.11.3/lib/pusher/client.rb:134:in `post'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/pusher-0.11.3/lib/pusher/client.rb:216:in `trigger'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/pusher-0.11.3/lib/pusher/channel.rb:59:in `trigger!'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/pusher-0.11.3/lib/pusher/channel.rb:71:in `trigger'
/Users/christian/Sites/casenexus/app/controllers/notifications_controller.rb:60:in `block in create'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal/mime_responds.rb:270:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal/mime_responds.rb:270:in `retrieve_collector_from_mimes'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal/mime_responds.rb:194:in `respond_to'
/Users/christian/Sites/casenexus/app/controllers/notifications_controller.rb:40:in `create'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in `process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:447:in `_run__2723577406764024271__process_action__2755147847840742796__callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in `process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal/rescue.rb:29:in `process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activerecord-3.2.8/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/newrelic_rpm-3.6.1.87/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:38:in `block in process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/newrelic_rpm-3.6.1.87/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:318:in `perform_action_with_newrelic_trace'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/newrelic_rpm-3.6.1.87/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in `process_action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:121:in `process'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:45:in `process'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal.rb:203:in `dispatch'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_controller/metal.rb:246:in `block in action'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:73:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:36:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:600:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:184:in `call!'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:164:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/newrelic_rpm-3.6.1.87/lib/new_relic/rack/error_collector.rb:12:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/newrelic_rpm-3.6.1.87/lib/new_relic/rack/agent_hooks.rb:18:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/newrelic_rpm-3.6.1.87/lib/new_relic/rack/browser_monitoring.rb:16:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/newrelic_rpm-3.6.1.87/lib/new_relic/rack/developer_mode.rb:28:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/warden-1.2.1/lib/warden/manager.rb:35:in `block in call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/warden-1.2.1/lib/warden/manager.rb:34:in `catch'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/warden-1.2.1/lib/warden/manager.rb:34:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/rack-1.4.5/lib/rack/conditionalget.rb:35:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/head.rb:14:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/flash.rb:242:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:339:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:64:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `_run__2979100583981751168__call__3555748325778021510__callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/reloader.rb:65:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in `call_app'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/application.rb:223:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:17:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
  Rendered layouts/_flash.html.haml (1.8ms)
  Rendered notifications/create.js.erb (4.3ms)
like image 565
christian Avatar asked May 26 '13 09:05

christian


1 Answers

Thanks to pusher support, the solution was to set the following along with my other credentials:

Pusher.host = "api-eu.pusher.com"

...this was required as my app is on the new EU Heroku cluster and the pusher-gem calls the US cluster where my pusher app_key/auth_key was invalid.

like image 89
christian Avatar answered Oct 03 '22 17:10

christian