I have a great headache.
I have a running 'web-app', writed whith Rails4, in production hosted on a Google Compute Engine virtual machine with Ubuntu 14.04, where I use Rpush gem/Firebase for notification to an Android app 'my-app'.
Locally I use a similar configuration for development: an environment rvm with same Rails version.
Simultaneously, with AndroidStudio, I'm developing 'my-app' android app.
On Ubuntu 16.04.
When Rails/Rpush send a notification, I receive it on 'my-app'.
So I controls both sides of notification process (except Firebase as middle tier).
Great.
It worked fine until some days ago.
Production enviroment continues to working well.
Locally, on development, when 'web-app' send a notification (through RPush/Firebase) I don't receive any kind of message, but I receive it in production, on 'released-version' of 'my-app' !!!
Normally, working local, when 'local' 'web-app' send notification, 'local' 'my-app' receive it;
in production, when 'host' 'we-app' send notification, 'released-version' of 'my-app' receive it.
For a few days is like if, in Firebase, in middle tier, each notification is broadcasted through 'released-version' of 'my-app', also if came from 'local' debug environment !!
Same releases for both envs.
It worked well until a few days ago.
Surely I've touched somethings ... the project is in progess.
I've much debugged, I've controlled many times configurations (local, host and Firebase) read many logs without results.
Everything seems working well !!
Someone know some ways to show me how debugging/understand this mysterious (for me) behavior ?
In Rails, when a message is saved, is triggered a method to push notification as described in GitHub by RPush repository.
In Android, in class 'MyFirebaseMessagingService extends FirebaseMessagingService', on overrided method 'onMessageReceived(RemoteMessage remoteMessage)' I receive messages (notification or data) - following 'quickstart-android/messaging' example.
In Firebase I have a project where I take 'Server Key' and 'google-services.json'.
My headache is growing.
Any advice is welcome.
UPDATE 20180326
I upgrade my question with code executed when sending message, configuration and an extract of rpush log (Rails server side - both local and hosted).
Rails method triggered after save 'Message'
def notify_gcm(data)
if Rpush::Gcm::App.find_by_name(<firebase_app>).nil?
app = Rpush::Gcm::App.new
app.name = <firebase_app>
app.auth_key = <firebase-server_key>
app.connections = 1
app.save!
end
n = Rpush::Gcm::Notification.new
n.app = Rpush::Gcm::App.find_by_name(<firebase_app>)
n.delay_while_idle = true
n.registration_ids = [<device_token>, ...]
n.priority = 'high'
n.content_available = true
# notification type: DATA MESSAGE
n.data = { data: { message: data[:message]["content"] }, notificationdata: { body: ..., title: ..., icon: ... }
}
n.save!
Rpush.push
end
config/initializers/rpush
Rpush.configure do |config|
config.client = :active_record
config.push_poll = 5
config.batch_size = 100
config.pid_file = 'tmp/rpush.pid'
config.log_file = 'log/rpush.log'
config.log_level = (defined?(Rails) && Rails.logger) ? Rails.logger.level : ::Logger::Severity::ERROR
end
Rpush log
BEGIN
INSERT INTO `rpush_notifications` (`type`, `app_id`, `delay_while_idle`, `registration_ids`, `priority`, `content_available`, `data`, `created_at`, `updated_at`) VALUES (...)
COMMIT
SELECT `rpush_apps`.* FROM `rpush_apps`[<firebase_app>] Starting 1 dispatcher...
SELECT COUNT(*) FROM `rpush_notifications` WHERE (processing = 0 AND delivered = 0 AND failed = 0 AND (deliver_after IS NULL OR deliver_after < '2018-03-25 10:27:22.719515'))
BEGIN
SELECT `rpush_notifications`.* FROM `rpush_notifications` WHERE (processing = 0 AND delivered = 0 AND failed = 0 AND (deliver_after IS NULL OR deliver_after < '2018-03-25 10:27:22.720521')) ORDER BY created_at ASC LIMIT 100 FOR UPDATE
UPDATE `rpush_notifications` SET processing = 1 WHERE rpush_notifications`.`id` = 210
COMMIT
SELECT COUNT(*) FROM `rpush_notifications` WHERE (processing = 0 AND delivered = 0 AND failed = 0 AND (deliver_after IS NULL OR deliver_after < '2018-03-25 10:27:22.774452'))
SELECT `rpush_apps`.* FROM `rpush_apps` WHERE `rpush_apps`.`id` = 1 LIMIT 1
[<firebase_app>] 210 sent to ... <proper registration_ids>
Rpush is started as a daemon by commandline:
rpush start -e production