"SenderId mismatch" - ZMninja using FCMV1

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
SkippyDo
Posts: 228
Joined: Mon Nov 20, 2017 6:49 pm

"SenderId mismatch" - ZMninja using FCMV1

Post by SkippyDo »

Lost notifications at some point: only realized it following a recent upgrade. Poked around and saw that the cloud server was changed and I made that change to zmeventnotification.ini (also zmeventnotification.pl): no other changes have been made from what used to work. Here's a debug of the failure point:
INF:2024-11-12,09:59:18 |----> FORK:Driveway (1), eid:67213 use hooks/start hook not being used, going to directly send out a notification if checks pass
11/12/2024 09:59:18.073460 zmeventnotification[152210].INF [main:1048] [|----> FORK:Driveway (1), eid:67213 use hooks/start hook not being used, going to directly send out a notification if checks pass]
DBG-2:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 rules: Checking rules for alarm caused by eid:67213, monitor:1, at: Tue Nov 12 09:59:20 2024 with cause:Forced Web
DBG-1:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 rules: No rules found for Monitor, allowing:1
DBG-1:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 Matching alarm to connection rules...
DBG-1:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 Checking alarm conditions for token ending in:...vP7OLj47ar
DBG-1:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 Monitor 1 event: last time not found, so should send
DBG-1:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 token is unique, shouldSendEventToConn returned true, so calling sendEvent
DBG-2:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 isAllowedChannel: got type:event_start resCode:0
INF:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 Sending event_start notification over FCM
11/12/2024 09:59:20.075006 zmeventnotification[152210].INF [main:1048] [|----> FORK:Driveway (1), eid:67213 Sending event_start notification over FCM]
DBG-2:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 fcmv1: FCM called when there is no start hook/or hooks are disabled, so making sure we do not use objdetect in url
DBG-2:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 setting channel to zmninja
DBG-2:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 fcmv1: Final JSON using FCMV1 being sent is: {"body":"Forced Web at 09:59 AM, 12-Nov","data":{"notification_foreground":"true","mid":"1","eid":"67213"},"android":{"priority":"high","channel":"zmninja","icon":"ic_stat_notification"},"image_url":"https://<my server URL/path>/index.php?view=image&eid=67213&fid=snapshot&width=600&username=backend&password=xxx} to token: ...Lj47ar
DBG-1:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 fcmv1: FCM push message error {"Error":"token:vP7OLj47ar=>SenderId mismatch"}

DBG-2:2024-11-12,09:59:20 |----> FORK:Driveway (1), eid:67213 child finished writing to parent
DBG-2:2024-11-12,09:59:23 PARENT: ----------> Tick START (active forks:1, total forks:2, active hooks: 0 running for:10 min)<--------------
DBG-2:2024-11-12,09:59:23 PARENT: After tick: TOTAL: 1, ES_CONTROL: 0, FCM+WEB: 0, FCM: 1, WEB: 0, MQTT:0, invalid WEB: 0, PENDING: 0
DBG-2:2024-11-12,09:59:23 PARENT: RAW TEXT-->fcm_notification--TYPE--fHC7lsE-QkujPsIGE5U_ak:APA91bGSsaTWTOEuE6BbGLOzWsKfXJp4TK9cZiEKYny6WkZyW6MJ4YU12p5v6o1HwYNUAJ5Ss890eTSMyMdkD-lgygWf_moEASrwZl6e5S4ntxMYG-VyD-M9bYSPONji7MvP7OLj47ar--SPLIT--2--SPLIT--82--SPLIT--10
DBG-2:2024-11-12,09:59:23 PARENT: GOT JOB==> update badge to 2, count to 82 for: fHC7lsE-QkujPsIGE5U_ak:APA91bGSsaTWTOEuE6BbGLOzWsKfXJp4TK9cZiEKYny6WkZyW6MJ4YU12p5v6o1HwYNUAJ5Ss890eTSMyMdkD-lgygWf_moEASrwZl6e5S4ntxMYG-VyD-M9bYSPONji7MvP7OLj47ar, at: 10
DBG-2:2024-11-12,09:59:23 PARENT: RAW TEXT-->timestamp--TYPE--1731433778.05514--SPLIT--1--SPLIT--1731434360.07484
DBG-2:2024-11-12,09:59:23 PARENT: Job: Update last sent timestamp of monitor:1 to 1731434360.07484 for id:1731433778.05514
DBG-2:2024-11-12,09:59:23 PARENT: There are 1 active child forks & 0 zm_detect processes running...
DBG-2:2024-11-12,09:59:23 PARENT: We've already worked on Monitor:1, Event:67213, not doing anything more
DBG-2:2024-11-12,09:59:23 PARENT: checkEvents() new events found=0
DBG-2:2024-11-12,09:59:23 PARENT: There are 0 new Events to process
DBG-2:2024-11-12,09:59:23 PARENT: ---------->Tick END (active forks:1, total forks:2, active hooks: 0)<--------------
Here's zmeventserver config output:
11/13/2024 10:29:46.234292 zmeventnotification[172402].INF [main:339] [Running on WebSocket library version:0.004]
11/13/2024 10:29:46.264358 zmeventnotification[172402].INF [main:1049] [PARENT: using config file: /etc/zm/zmeventnotification.ini]
11/13/2024 10:29:46.268507 zmeventnotification[172402].INF [main:1049] [PARENT: using secrets file: /etc/zm/secrets.ini]

Configuration (read /etc/zm/zmeventnotification.ini):

Secrets file.......................... /etc/zm/secrets.ini
Base data path........................ /var/lib/zmeventnotification
Restart interval (secs)............... 0

Use admin interface .................. no
Admin interface password.............. (undefined)
Admin interface persistence file ..... /var/lib/zmeventnotification/misc/escontrol_interface.dat

Port ................................. 9000
Address .............................. [::]
Event check interval ................. 5
Monitor reload interval .............. 300
Skipped monitors...................... (undefined)

Auth enabled ......................... yes
Auth timeout ......................... 20

Use API Push.......................... no
API Push Script....................... (undefined)

Use FCM .............................. yes
Use FCM V1 APIs....................... yes
FCM Date Format....................... %I:%M %p, %d-%b
Only show latest FCMv1 message........ no
Android FCM push priority............. high
Android FCM push ttl.................. (undefined)
Log FCM message ID.................... NONE
Log RAW FCM Messages...................no
FCM V1 URL............................ https://us-central1-zoneminder-ninja.cl ... /send_push
FCM V1 Key.............................custom

Token file ........................... /var/lib/zmeventnotification/push/tokens.txt

Use MQTT ............................. no
MQTT Server .......................... 127.0.0.1
MQTT Topic ........................... zoneminder
MQTT Username ........................ (undefined)
MQTT Password ........................ (undefined)
MQTT Retain .......................... no
MQTT Tick Interval ................... 15
MQTT TLS CA ........................ (undefined)
MQTT TLS Cert ........................ (undefined)
MQTT TLS Key ........................ (undefined)
MQTT TLS Insecure ........................ no

SSL enabled .......................... yes
SSL cert file ........................ /etc/letsencrypt/live/<my server>/fullchain.pem
SSL key file ......................... /etc/letsencrypt/live/<my server>/privkey.pem

Verbose .............................. no
ES Debug level.........................4
Read alarm cause ..................... yes
Tag alarm event id ................... yes
Use custom notification sound ........ no
Send event start notification..........yes
Send event end notification............no
Monitor rules JSON file................(undefined)

Use Hooks............................. no
Max Parallel Hooks.................... 0
Hook Script on Event Start ........... '/var/lib/zmeventnotification/bin/zm_event_start.sh'
User Script on Event Start.............(undefined)
Hook Script on Event End.............. (undefined)
User Script on Event End...............(undefined)
Hook Skipped monitors................. (undefined)

Notify on Event Start (hook success).. all
Notify on Event Start (hook fail)..... none
Notify on Event End (hook success).... fcm,web,api
Notify on Event End (hook fail)....... none
Notify End only if Start success...... yes

Use Hook Description.................. yes
Keep frame match type................. yes
Store Frame in ZM......................yes

Picture URL .......................... https://<my server and path>/index.php?view=image&eid=EVENTID&fid=snapshot&width=600
Include picture....................... yes
Picture username ..................... backend
Picture password ..................... (defined)
I've cleared the API cache on my android phone to no effect.

Also adding this error from ZM logs (via web console):
web_php 153127 ERR Unable to authenticate user from auth hash '0983aee6c9258fd91ce35eda681f2be2' /usr/share/zoneminder/www/includes/auth.php 217
User avatar
iconnor
Posts: 3263
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: "SenderId mismatch" - ZMninja using FCMV1

Post by iconnor »

Did you update the fcm key as well?

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJnZW5lcmF0b3IiOiJwbGlhYmxlIHBpeGVscyIsImlhdCI6MTcyNzQ0OTI1MCwiY2xpZW50Ijoiem1uaW5qYSJ9.2to4a_X0EQ8MtXyNzVCHfftn6zDn6QpwlSjVYicUq8I
SkippyDo
Posts: 228
Joined: Mon Nov 20, 2017 6:49 pm

Re: "SenderId mismatch" - ZMninja using FCMV1

Post by SkippyDo »

Connor, yes. I'd ran across another thread that was discussing all of this and that's where I found out that I needed to change the cloud server and the key. Here's what I have in my zmeventserver.ini file:

#fcm_v1_key = myspecialkey
fcm_v1_key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJnZW5lcmF0b3IiOiJwbGlhYmxlIHBpeGVscyIsImlhdCI6MTcyNzQ0OTI1MCwiY2xpZW50Ijoiem1uaW5qYSJ9.2to4a_X0EQ8MtXyNzVCHfftn6zDn6QpwlSjVYicUq8I
# fcm_v1_url = https://my_custom_url/function_name
fcm_v1_url = https://us-central1-zoneminder-ninja.cl ... /send_push
SkippyDo
Posts: 228
Joined: Mon Nov 20, 2017 6:49 pm

Re: "SenderId mismatch" - ZMninja using FCMV1

Post by SkippyDo »

I installed the latest zmeventserver code just to make sure everything was up to date.

Running in debug I am now getting:

11/13/2024 18:43:29.019283 zmeventnotification[184321].INF [main:3282] [1 is in hook skip list, not using hooks]
11/13/2024 18:43:31.020014 zmeventnotification[184321].INF [main:2954] [Sending event_start notification over FCM]
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3457.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3596.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3675.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3457.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3596.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3675.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3457.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3596.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3675.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3457.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3596.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3675.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3457.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3596.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3675.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3457.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3596.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3675.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3457.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3596.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3675.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3457.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3596.
Use of uninitialized value in string eq at /usr/bin/zmeventnotification.pl line 3675.
11/13/2024 18:43:47.281333 zmeventnotification[184321].INF [main:3693] [Event 67231 for Monitor 1 has finished]
11/13/2024 18:43:49.281851 zmeventnotification[184321].INF [main:3461] [1 is in hook skip list, not using hooks]
11/13/2024 18:43:51.282212 zmeventnotification[184321].INF [main:2954] [Sending event_end notification over FCM]
11/13/2024 18:48:29.015144 zmeventnotification[184297].INF [main:1441] [Re-loading monitors]

It appears that "$alarm->{End}->{State}" isn't defined.

I am not using hooks. I am also not sending out event end notices.

And still no notifications popping up on my phone: but now not seeing the SenderId errors.
SkippyDo
Posts: 228
Joined: Mon Nov 20, 2017 6:49 pm

Re: "SenderId mismatch" - ZMninja using FCMV1

Post by SkippyDo »

I'll also note that it appears that the function sendOverFCM1 is unable to handle a match_type containing "forced alarm".
secfalcon
Posts: 2
Joined: Mon Dec 02, 2024 10:19 pm

Re: "SenderId mismatch" - ZMninja using FCMV1

Post by secfalcon »

SkippyDo - Are you using zmNinja on iOS or Android? Which version?

I had the same issue today. Some troubleshooting identified a change (https://github.com/ZoneMinder/zmNinja/c ... ce920bab65) made its way into zmNinja v1.7.002 on 2023-11-28 that updated the firebase project IDs as part of the transition to the ZoneMinder team.

v1.7.002+ has only been released to the "zmNinja" app on Android and has not been pushed to "zmNinja Pro" on Android or in the Apple Store. I was using zmNinja Pro on Android and running into this issue. As soon as I re-purchased the "zmNinja" app (rather than my existing "Pro"), I began receiving event notifications without issue.

It seems only the "zmNinja" app within the Google Play store is being kept update to date while the "zmNinja Pro" on Google Play and Apple Store are not being updated.


Android
- zmNinja - v1.7.007 updated on 5/7/2024
- https://play.google.com/store/apps/deta ... a&hl=en_US

- zmNinja Pro - v1.6.009 updated on 7/14/2021
- https://play.google.com/store/apps/deta ... o&hl=en_US


iOS
- zmNinja Pro - v1.6.009 updated on 7/15/2021
- https://apps.apple.com/us/app/zmninja-pro/id1067914954
SkippyDo
Posts: 228
Joined: Mon Nov 20, 2017 6:49 pm

Re: "SenderId mismatch" - ZMninja using FCMV1

Post by SkippyDo »

secfalcon, sorry for the delay but I didn't catch your post (for got to tick off the notification box- now done!)

I'm using Android. I'm running zmNinja V1.6009: I'd like to update but I don't have Google Pay set up. I do not see, however, that this has any affect on my current issue of the uninitialized variables within the server software. I've pretty much just given up on resolving this (seems every time I do any updates I have to fight something that breaks)- more critical things in life for me... (perhaps it'll "magically" fix itself with a future update, should I must the courage to do an update)
Post Reply