/logs 中的推送通知错误

我们频繁看到以下错误填充 /logs(每天数十到数百次)。除了这似乎与推送通知相关外,我不确定具体发生了什么,以及是否需要处理?这是在使用最新 stable 版本时出现的。

Failed to send push notification : host: fcm.googleapis.com, #<Net::HTTPForbidden 403 Forbidden readbody=true> body: the key in the authorization header does not correspond to the sender ID used to subscribe this user. Please ensure you are using the correct sender ID and server Key from the Firebase console.

backtrace

webpush-1.0.0/lib/webpush/request.rb:165:in verify_response' webpush-1.0.0/lib/webpush/request.rb:32:in perform’
webpush-1.0.0/lib/webpush.rb:44:in payload_send' /var/www/discourse/app/services/push_notification_pusher.rb:79:in send_notification’
/var/www/discourse/app/services/push_notification_pusher.rb:25:in block in push' activerecord-6.0.3.1/lib/active_record/relation/delegation.rb:87:in each’
activerecord-6.0.3.1/lib/active_record/relation/delegation.rb:87:in each' /var/www/discourse/app/services/push_notification_pusher.rb:23:in push’
/var/www/discourse/app/jobs/regular/send_push_notification.rb:7:in execute' /var/www/discourse/app/jobs/base.rb:232:in block (2 levels) in perform’
rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:68:in with_connection' /var/www/discourse/app/jobs/base.rb:221:in block in perform’
/var/www/discourse/app/jobs/base.rb:217:in each' /var/www/discourse/app/jobs/base.rb:217:in perform’
sidekiq-6.0.7/lib/sidekiq/processor.rb:196:in execute_job' sidekiq-6.0.7/lib/sidekiq/processor.rb:164:in block (2 levels) in process’
sidekiq-6.0.7/lib/sidekiq/middleware/chain.rb:138:in block in invoke' /var/www/discourse/lib/sidekiq/pausable.rb:138:in call’
sidekiq-6.0.7/lib/sidekiq/middleware/chain.rb:140:in block in invoke' sidekiq-6.0.7/lib/sidekiq/middleware/chain.rb:143:in invoke’
sidekiq-6.0.7/lib/sidekiq/processor.rb:163:in block in process' sidekiq-6.0.7/lib/sidekiq/processor.rb:136:in block (6 levels) in dispatch’
sidekiq-6.0.7/lib/sidekiq/job_retry.rb:111:in local' sidekiq-6.0.7/lib/sidekiq/processor.rb:135:in block (5 levels) in dispatch’
sidekiq-6.0.7/lib/sidekiq.rb:37:in block in <module:Sidekiq>' sidekiq-6.0.7/lib/sidekiq/processor.rb:131:in block (4 levels) in dispatch’
sidekiq-6.0.7/lib/sidekiq/processor.rb:257:in stats' sidekiq-6.0.7/lib/sidekiq/processor.rb:126:in block (3 levels) in dispatch’
sidekiq-6.0.7/lib/sidekiq/job_logger.rb:13:in call' sidekiq-6.0.7/lib/sidekiq/processor.rb:125:in block (2 levels) in dispatch’
sidekiq-6.0.7/lib/sidekiq/job_retry.rb:78:in global' sidekiq-6.0.7/lib/sidekiq/processor.rb:124:in block in dispatch’
sidekiq-6.0.7/lib/sidekiq/logger.rb:10:in with' sidekiq-6.0.7/lib/sidekiq/job_logger.rb:33:in prepare’
sidekiq-6.0.7/lib/sidekiq/processor.rb:123:in dispatch' sidekiq-6.0.7/lib/sidekiq/processor.rb:162:in process’
sidekiq-6.0.7/lib/sidekiq/processor.rb:78:in process_one' sidekiq-6.0.7/lib/sidekiq/processor.rb:68:in run’
sidekiq-6.0.7/lib/sidekiq/util.rb:15:in watchdog' sidekiq-6.0.7/lib/sidekiq/util.rb:24:in block in safe_thread’

2 个赞

我也遇到同样的问题:confused:

有趣的是,如果我们的会员在 Android 上先禁用再重新启用推送通知,那么几天内功能正常,但之后日志中会出现大量警告:arrow_down:,随后推送通知停止工作。

发送推送通知失败:host: fcm.googleapis.com, #<Net::HTTPForbidden 403 Forbidden readbody=true>
正文:
授权头中的密钥与订阅此用户时使用的发送者 ID 不匹配。请确保您使用的是 Firebase 控制台中正确的发送者 ID 和服务器密钥。
5 个赞

现在它在我这里正常运行了两周,但重新构建后又停止工作了。因此,我认为这可能与重新构建应用的过程有关。当我在管理后台进行升级后,功能又能正常运行。目前唯一能修复安卓推送的方法,是让会员禁用并重新启用该功能。但这只能维持到下一次重新构建。

重新构建是否可能导致了此问题?

1 个赞

是的,这正是我们论坛遇到的问题。每次我重建应用时,推送通知就会停止工作。但现在看来我们论坛的问题已经解决了。我第三次重建后,推送通知依然运行良好。:heart_eyes: 我不知道具体是什么问题,但非常感谢你的修复!:slightly_smiling_face:

1 个赞