Using rapns on heroku for push notification

2019-09-07 06:49发布

问题:

I'm using gem rapns (https://github.com/ileitch/rapns) on my rails app.

According to rapns doc, I need to run

bundle exec rapns

to kick start the daemon process which checks database for new notifications to send.

So I did following:

heroku run bundle exec rapns production --foreground

which gave me error:

Running bundle exec rapns production --foreground attached to terminal... up, run.3
[WARNING] Detected Rails 3.1.1, patching PostgreSQLAdapter to fix reconnection bug: https://github.com/rails/rails/issues/3160
/app/.bundle/gems/ruby/1.9.1/gems/rapns-1.0.1/lib/rapns/daemon.rb:95:in initialize': No such file or directory - /app/tmp/pids/rapns.pid (Errno::ENOENT)
from /app/.bundle/gems/ruby/1.9.1/gems/rapns-1.0.1/lib/rapns/daemon.rb:95:inopen'
from /app/.bundle/gems/ruby/1.9.1/gems/rapns-1.0.1/lib/rapns/daemon.rb:95:in write_pid_file'
from /app/.bundle/gems/ruby/1.9.1/gems/rapns-1.0.1/lib/rapns/daemon.rb:43:instart'
from /app/.bundle/gems/ruby/1.9.1/gems/rapns-1.0.1/bin/rapns:28:in <top (required)>'
from /app/.bundle/gems/ruby/1.9.1/bin/rapns:19:inload'
from /app/.bundle/gems/ruby/1.9.1/bin/rapns:19:in `'

I'm very very new to rails and ruby, can someone tell me what's going wrong?

回答1:

You need to remove the pid_file option from the production configuration and/or upgrade to 1.0.2, which is tolerant of a non-writable pid_file option.