Comments (6)
It looks as though the payload from the feedback service isn't what we expected.
@zmajstor could you please add this to config/initializers/rapns_debug.rb
(restart rapns) and paste me the output when the error happens again?
require 'rapns/daemon'
module Rapns
module Daemon
class FeedbackReceiver
def parse_tuple(tuple)
debug_str = <<-EOS
--- DEBUG ---
#{tuple.inspect}
#{tuple.unpack("N1n1H*").inspect}
--- DEBUG ---
EOS
Rapns::Daemon.logger.info(debug_str)
failed_at, _, device_token = tuple.unpack("N1n1H*")
[Time.at(failed_at).utc, device_token]
end
end
end
end
from rapns.
thanks for quick response, debug data below:
$ bundle exec rapns production -f
[2012-07-25 16:32:03] [FeedbackReceiver:my_app2] Connected to feedback.push.apple.com:2196
[2012-07-25 16:32:03] [DeliveryHandler:my_app2] Connected to gateway.push.apple.com:2195
[2012-07-25 16:32:03] [DeliveryHandler:my_app2] 4 sent to 92e5bf612965f22a72a5b17b9515fc689e5b98b2fe4d3d5f8d8d333398b82430
[2012-07-25 16:33:03] [FeedbackReceiver:my_app2] Connected to feedback.push.apple.com:2196
[2012-07-25 16:33:03] --- DEBUG ---
"P\x10\x03c\x00 \x92\xE5\xBFa)e\xF2*r\xA5\xB1{\x95\x15\xFCh\x9E[\x98\xB2\xFEM=_\x8D\x8D33\x98\xB8$0"
[1343226723, 32, "92e5bf612965f22a72a5b17b9515fc689e5b98b2fe4d3d5f8d8d333398b82430"]
--- DEBUG ---
[2012-07-25 16:33:03] [FeedbackReceiver:my_app2] Delivery failed at 2012-07-25 14:32:03 UTC for 92e5bf612965f22a72a5b17b9515fc689e5b98b2fe4d3d5f8d8d333398b82430
[2012-07-25 16:33:03] [ERROR] ActiveRecord::RecordInvalid, Validation failed: Device token can't be blank, Device token is invalid, Failed at can't be blank
.....
from rapns.
strange: after few more attempts, the error disappeared (blame it on the glitch in APNS :-) - also, I found error on another side: the certificate that server uses to send push notifications didn't had the same topic in subject as Topic in MDM payload - now works just fine!
thanks!
from rapns.
The debug info looks fine, hmm..
What version of Ruby are you using?
Does the ERROR message have a stack trace?
Are you using any plugins/gems that affect the default mass-assignment behaviour of models?
from rapns.
I'm using ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
and rails 3.2.6
my test rails app has bare minimum to run rapns
(just what is generated with rails new TestAPNS
so other gems are just standard "Rails pack":
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
I guess this is stack trace:
$ bundle exec rapns production -f
[2012-07-25 17:21:21] [DeliveryHandler:my_app2] Connected to gateway.push.apple.com:2195
[2012-07-25 17:21:21] [FeedbackReceiver:my_app2] Connected to feedback.push.apple.com:2196
[2012-07-25 17:21:21] [DeliveryHandler:my_app2] 6 sent to 92e5bf612965f22a72a5b17b9515fc689e5b98b2fe4d3d5f8d8d333398b82430
[2012-07-25 17:22:21] [FeedbackReceiver:my_app2] Connected to feedback.push.apple.com:2196
[2012-07-25 17:22:21] --- DEBUG ---
"P\x10\x0E\xF1\x00 \x92\xE5\xBFa)e\xF2*r\xA5\xB1{\x95\x15\xFCh\x9E[\x98\xB2\xFEM=_\x8D\x8D33\x98\xB8$0"
[1343229681, 32, "92e5bf612965f22a72a5b17b9515fc689e5b98b2fe4d3d5f8d8d333398b82430"]
--- DEBUG ---
[2012-07-25 17:22:21] dt: 92e5bf612965f22a72a5b17b9515fc689e5b98b2fe4d3d5f8d8d333398b82430
[2012-07-25 17:22:21] [FeedbackReceiver:my_app2] Delivery failed at 2012-07-25 15:21:21 UTC for 92e5bf612965f22a72a5b17b9515fc689e5b98b2fe4d3d5f8d8d333398b82430
[2012-07-25 17:22:21] [ERROR] ActiveRecord::RecordInvalid, Validation failed: Device token can't be blank, Device token is invalid, Failed at can't be blank
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/validations.rb:56:in `save!'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/transactions.rb:246:in `block in save!'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/transactions.rb:208:in `transaction'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/transactions.rb:246:in `save!'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.6/lib/active_record/validations.rb:41:in `create!'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/rapns-2.0.1/lib/rapns/daemon/feedback_receiver.rb:60:in `create_feedback'
/Users/zoran/Sites/Test/TestAPNS/config/initializers/rapns_debug.rb:27:in `check_for_feedback'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/rapns-2.0.1/lib/rapns/daemon/feedback_receiver.rb:21:in `block (2 levels) in start'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/rapns-2.0.1/lib/rapns/daemon/feedback_receiver.rb:19:in `loop'
/Users/zoran/.rvm/gems/ruby-1.9.3-p194/gems/rapns-2.0.1/lib/rapns/daemon/feedback_receiver.rb:19:in `block in start'
[2012-07-25 17:23:22] [FeedbackReceiver:my_app2] Connected to feedback.push.apple.com:2196
from rapns.
I have just released 2.0.2 which should fix this issue. Newer versions of Rails require that models explicitly whitelist attributes. This is enabled by default in application.rb
with config.active_record.whitelist_attributes = true
.
Thanks for reporting the issue!
from rapns.
Related Issues (20)
- Update at the end HOT 2
- Rapns Worker stalls and not setting notifications as delivered HOT 8
- Multiple databases support HOT 2
- Trying Rapns with Safari Push HOT 10
- NoMethodError raised when GCM post responds with 500
- add notification table HOT 4
- Rapns daemon process get killed HOT 4
- [ERROR] NoMethodError, undefined method `to_binary' for Rapns::Notification HOT 4
- GCM returns an error for messages with Spanish characters
- new release? HOT 5
- fatal: deadlock detected HOT 1
- fatal: deadlock detected
- ActiveRecord::ConnectionTimeoutError HOT 3
- NameError, uninitialized constant Rapns::Daemon::Apn HOT 3
- Notification received on the phone but the rapns_notifications database still list the notification as not delivered
- apns slow HOT 2
- Testing github-issues-import.
- Best practise for maintaining rapns_notifications table.
- Certificate has been revoked (Rails Console & Controller both) HOT 1
- @app should be @app.name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rapns.