2013-05-26 6 views
6

プッシャーを既にかなり遅い段階のRailsアプリに挿入しようとしています。クライアント側はうまく動作します.Pusher Event Creatorを使用すると、目的のJavaScriptがトリガーされます。サーバ側が作動していません。Pusher in Rails: "Unknown auth_key" - サーバー側でイベントが発生しない

を私の通知にコントローラがテストにアクションを作成するには、次のコードを使用する:

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

は、このエラーを与える:

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

(とでは何も新しい表示されデバッグコンソール)

私はこれを開発環境で実行しています。私は私のシステム上で 'プッシャー/通知'サンプルアプリケーションをテストし、クライアントとサーバーの両方で問題なく動作します。 development.rbで

# Pusher 
    require 'pusher' 

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

    Pusher.logger = Rails.logger 

がアップデート - フルログ出力:

Unknown auth_key (Pusher::AuthenticationError) 
/usr/local/rvm/gems/[email protected]/gems/pusher-0.11.3/lib/pusher/request.rb:99:in `handle_response' 
/usr/local/rvm/gems/[email protected]/gems/pusher-0.11.3/lib/pusher/request.rb:52:in `send_sync' 
/usr/local/rvm/gems/[email protected]/gems/pusher-0.11.3/lib/pusher/resource.rb:18:in `post' 
/usr/local/rvm/gems/[email protected]/gems/pusher-0.11.3/lib/pusher/client.rb:134:in `post' 
/usr/local/rvm/gems/[email protected]/gems/pusher-0.11.3/lib/pusher/client.rb:216:in `trigger' 
/usr/local/rvm/gems/[email protected]/gems/pusher-0.11.3/lib/pusher/channel.rb:59:in `trigger!' 
/usr/local/rvm/gems/[email protected]/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/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal/mime_responds.rb:270:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal/mime_responds.rb:270:in `retrieve_collector_from_mimes' 
/usr/local/rvm/gems/[email protected]/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/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal/implicit_render.rb:4:in `send_action' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:167:in `process_action' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal/rendering.rb:10:in `process_action' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:18:in `block in process_action' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:447:in `_run__2723577406764024271__process_action__2755147847840742796__callbacks' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/abstract_controller/callbacks.rb:17:in `process_action' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal/rescue.rb:29:in `process_action' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal/instrumentation.rb:29:in `process_action' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal/params_wrapper.rb:207:in `process_action' 
/usr/local/rvm/gems/[email protected]/gems/activerecord-3.2.8/lib/active_record/railties/controller_runtime.rb:18:in `process_action' 
/usr/local/rvm/gems/[email protected]/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/[email protected]/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/[email protected]/gems/newrelic_rpm-3.6.1.87/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in `process_action' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/abstract_controller/base.rb:121:in `process' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/abstract_controller/rendering.rb:45:in `process' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal.rb:203:in `dispatch' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_controller/metal.rb:246:in `block in action' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:73:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:73:in `dispatch' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:36:in `call' 
/usr/local/rvm/gems/[email protected]/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call' 
/usr/local/rvm/gems/[email protected]/gems/journey-1.0.4/lib/journey/router.rb:56:in `each' 
/usr/local/rvm/gems/[email protected]/gems/journey-1.0.4/lib/journey/router.rb:56:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:600:in `call' 
/usr/local/rvm/gems/[email protected]/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:184:in `call!' 
/usr/local/rvm/gems/[email protected]/gems/omniauth-1.1.4/lib/omniauth/strategy.rb:164:in `call' 
/usr/local/rvm/gems/[email protected]/gems/newrelic_rpm-3.6.1.87/lib/new_relic/rack/error_collector.rb:12:in `call' 
/usr/local/rvm/gems/[email protected]/gems/newrelic_rpm-3.6.1.87/lib/new_relic/rack/agent_hooks.rb:18:in `call' 
/usr/local/rvm/gems/[email protected]/gems/newrelic_rpm-3.6.1.87/lib/new_relic/rack/browser_monitoring.rb:16:in `call' 
/usr/local/rvm/gems/[email protected]/gems/newrelic_rpm-3.6.1.87/lib/new_relic/rack/developer_mode.rb:28:in `call' 
/usr/local/rvm/gems/[email protected]/gems/warden-1.2.1/lib/warden/manager.rb:35:in `block in call' 
/usr/local/rvm/gems/[email protected]/gems/warden-1.2.1/lib/warden/manager.rb:34:in `catch' 
/usr/local/rvm/gems/[email protected]/gems/warden-1.2.1/lib/warden/manager.rb:34:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' 
/usr/local/rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call' 
/usr/local/rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/conditionalget.rb:35:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/head.rb:14:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/params_parser.rb:21:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/flash.rb:242:in `call' 
/usr/local/rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context' 
/usr/local/rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/cookies.rb:339:in `call' 
/usr/local/rvm/gems/[email protected]/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:64:in `call' 
/usr/local/rvm/gems/[email protected]/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `_run__2979100583981751168__call__3555748325778021510__callbacks' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_call_callbacks' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/reloader.rb:65:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
/usr/local/rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in `call_app' 
/usr/local/rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in `call' 
/usr/local/rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call' 
/usr/local/rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call' 
/usr/local/rvm/gems/[email protected]/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
/usr/local/rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call' 
/usr/local/rvm/gems/[email protected]/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call' 
/usr/local/rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call' 
/usr/local/rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/application.rb:223:in `call' 
/usr/local/rvm/gems/[email protected]/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call' 
/usr/local/rvm/gems/[email protected]/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:17:in `call' 
/usr/local/rvm/gems/[email protected]/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) 
+0

これは、私がRails 3アプリでどのように使用しているかに似ているようですが、各config/environments/* .rbファイルではなく、イニシャライザにプッシャー設定があります。 – pat

+0

ありがとうpat - 私は代わりにイニシャライザに設定を入れてみました。それでも同じエラーが発生します。 Bizarely、今私は古いトリガーの構文(プッシャー[チャンネル名] ...)を使用すると、私は今もエラーを取得 - 私はここで手がかりをつかまえている。どういうわけか私の広いアプリに何かが干渉している可能性がありますか? – christian

+0

あなたは正しい資格を持っているだけでなく、正しい順序でチェックされているだけでなく(例えば、秘密が鍵に設定されていないなど)、トリプルチェックをしましたか? – pat

答えて

18

ソリューションは、私の他の資格情報と一緒に次のように設定したプッシャーのサポートのおかげで、:

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

...これは私のapとして必要でしたpは新しいEU Herokuクラスタにあり、プッシャー - 宝石は私のプッシャーapp_key/auth_keyが無効だった米国のクラスターを呼び出します。

+6

これは彼らの文書にもっと広告されるべきです。それ以外はどうすればわかるのだろうか?共有ありがとう! –

+0

これは間違いなく文書ではっきりしているはずです。私はこれを解決することなく、3日を彼らの支援で過ごしました。これは開発環境の問題でしかないようですが、私の制作EUアプリケーションはそれがなくても動作しました。 – DannyB

関連する問題