Manager firebase push notification strange error

Macan2 years ago

I setup the firebase push notifications and it is working when I click test channels , I receive push message via android manager app but I get red colored error message on the web app when I do test :

Requested entity was not found. - FirebaseMessagingException (... < NotificatorFirebase:94 < NotificationResource:96 < ...)

Does someone have similar experience and what this error mean?

Anton Tananaev2 years ago

Seems like you have some configuration issue.

Macan2 years ago

What can be wrong ?

My configuration on server:

    <entry key='notificator.types'>web,mail,traccar,firebase</entry>
    <entry key='notificator.firebase.serviceAccount'>
{
  "type": "service_account",
  "project_id": "*****",
  "private_key_id": "*******",
  "private_key": "-----BEGIN PRIVATE KEY-----xxxxxxxxxxxxxxxxxxxxxxxxxxxx-----END PRIVATE KEY-----\n",
  "client_email": "xxxxxxx.iam.gserviceaccount.com",
  "client_id": "xxxxxxxxxxx",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-asm5x%40xxxxxxxx.iam.gserviceaccount.com"
}
</entry>

My configuration in the app json file:

{
  "project_info": {
    "project_number": "xxxxxxxxxxxxxx",
    "project_id": "xxxxxxxxxx",
    "storage_bucket": "xxxxxxxxxx.appspot.com"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "1:216748393231:android:xxxxxxxxx",
        "android_client_info": {
          "package_name": "xxxxxxxxxxxxxr"
        }
      },
      "oauth_client": [
        {
          "client_id": "xxxxxxxxxxxxxx-amahpv7la74ppprgbnecrdegf6advfre.apps.googleusercontent.com",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "xxxxxxxxxxxxxxxxxxxxxx"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "xxxxxxx-amahpv7la74ppprgbnecrdegf6advfre.apps.googleusercontent.com",
              "client_type": 3
            }
          ]
        }
      }
    }
  ],
  "configuration_version": "1"
}
Armoura year ago

Hi Macan!
I have the same issue as you.
Can you figure out how to fix it?

Macana year ago

I didn't add any device and I tested , when you add a device the real notification not Test is works fine.

Lukasza year ago

Hi,

I have the same problem. Notifications works but I get an error:

Requested entity was not found. - FirebaseMessagingException (... < NotificatorFirebase:94 < NotificationResource:96 < ...)

In the console I see an error:

POST http://192.168.3.20:8082/api/notifications/test/firebase 400 (Bad Request) NotificationPage.js:44 

Has anyone managed to solve this problem?
Luke

Anton Tananaeva year ago

Are you sure you've correctly set up firebase on the server and in your custom app?

Lukasza year ago

So far I've been using traccar 4.11 and a custom application - everything worked.

Today I migrated to traccar 5.5, the application is the same as in 4.11 (I will compile a new application next week).
I changed the firebase settings to:

<entry key='notificator.types'>web,mail,firebase,traccar</entry>
<entry key='notificator.firebase.serviceAccount'>
{ 
"type": "service_account", 
"project_id": "xxx",
"private_key_id": "xxx", 
"private_key": "-----BEGIN PRIVATE KEY-----xxxxxxxxxxxxxxxx-----END PRIVATE KEY-----\n", 
"client_email": "xxxxxxx",
"client_id": "xxxxx",
"auth_uri": "https://accounts.google.com/o/oauth2/auth", 
"token_uri": "https://oauth2.googleapis.com/token", 
"auth_provider_x509_cert_url": "xxx", 
"client_x509_cert_url": "xxxx"
}
</entry>

notifications arrive but there is an error in the console.

Macana year ago

Maybe it is some bug when you test it without any device existing on the platform.

Lukasza year ago

@Macan - I have registered and working devices. I have an error when testing the notification. Notifications come to the phone.

Today I compiled the apps again. The error is still there, I noticed it is different in view:
Modern:

Requested entity was not found. - FirebaseMessagingException (... < NotificatorFirebase:94 < NotificationResource:96 < ...)
NotificationPage.js:44          POST https://xxxx/api/notifications/test/firebase 400 (Bad Request)

Legacy

Requested entity was not found. - FirebaseMessagingException (... < NotificatorFirebase:94 < NotificationResource:86 < ...)
ext-all.js:22          POST https://xxxxx/api/notifications/test 400 (Bad Request)

Lukasz

Lukasza year ago

I noticed an interesting thing:
I use the mySQL database that I had with previous versions of traccar.

The error is with notifications for old users, for new users (created by traccar 5.5) there is no error.
I'm checking the database, if I find a problem I'll let you know

Lukasz

Lukasza year ago

Update:
I noticed that notificationTokens was much longer for old users than for new ones. Removing the old token and generating a new one solved the problem.

control takena year ago

Cordial greetings my dear colleague Lukas, I am writing for the same problem, I am using version 5.6, this is new, the database creates the users from scratch but I generated the json key from firebase and it currently gives me the same error.

The question to my question is if your solution was to generate again the token that is downloaded from firebase the json where is the new key token? and replace it with the old one that had been generated?

I'll look forward for your answer.

Anton Tananaeva year ago
URLEY REYa year ago

So I regenerate the jar file and replacement from the source code... Or the official version is with these changes already made.