ZoneMinder / zmeventnotification

Machine Learning powered Secure Websocket & MQTT based ZoneMinder event notification server
407 stars 127 forks source link

Unable to send FCM notification (500 Server Error) #418

Open drzef opened 2 years ago

drzef commented 2 years ago

Event Server version

6.1.28

The version of ZoneMinder you are using:

1.36.24

What is the nature of your issue

Bug

Details

When an event is triggered (through motion detection or forced) the server receive an error from the standard cloud function, an HTTP 500 response. Everything seems working correctly in my installation, except for this part. I'm using no hooks, no ML, just the plain event server. I have begun to see this error since the beginning of august and I've waited to see if this was temporary.

Debug Logs (if applicable)


INF:2022-08-21,00:15:16 PARENT: New event 4438 reported for Monitor:1 (Name:Monitor 1) Forced Web[last processed eid:]
08/21/22 00:15:16.676627 zmeventnotification[12094].INF [main:1048] [PARENT: New event 4438 reported for Monitor:1 (Name:Ingresso) Forced Web[last processed eid:]]
DBG-2:2022-08-21,00:15:16 PARENT: checkEvents() new events found=1
DBG-2:2022-08-21,00:15:16 PARENT: There are 1 new Events to process
DBG-2:2022-08-21,00:15:16 PARENT: ---------->Tick END (active forks:1, total forks:1, active hooks: 0)<--------------
DBG-1:2022-08-21,00:15:16 PARENT: Forked process:12181 to handle alarm eid:4438
INF:2022-08-21,00:15:16 |----> FORK:Monitor 1 (1), eid:4438 use hooks/start hook not being used, going to directly send out a notification if checks pass
08/21/22 00:15:16.681212 zmeventnotification[12181].INF [main:1048] [|----> FORK:Monitor 1 (1), eid:4438 use hooks/start hook not being used, going to directly send out a notificatio
n if checks pass]
DBG-2:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 rules: Checking rules for alarm caused by eid:4438, monitor:1, at: Sun Aug 21 00:15:18 2022 with cause:Forced Web
DBG-1:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 rules: No rules found for Monitor, allowing:1
DBG-1:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 Matching alarm to connection rules...
DBG-1:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 Checking alarm conditions for token ending in:...ClHYhNxOhN
DBG-1:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 Monitor 1 event: last time not found, so should send
DBG-1:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 token is unique, shouldSendEventToConn returned true, so calling sendEvent
DBG-2:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 isAllowedChannel: got type:event_start resCode:0
INF:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 Sending event_start notification over FCM
08/21/22 00:15:18.682824 zmeventnotification[12181].INF [main:1048] [|----> FORK:Monitor 1, eid:4438 Sending event_start notification over FCM]
DBG-2:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 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:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 setting channel to zmninja
DBG-2:2022-08-21,00:15:18 |----> FORK:Monitor 1, eid:4438 fcmv1: Final JSON using FCMV1 being sent is: {"image_url":"https://cctv.xxx.yyy/zm/index.php?view=image&eid=
4438&fid=objdetect&width=600&username=zzz&password=xxx},"body":"Forced Web at 00:15, 21-Aug","sound":"default","token":" ...hNxOhN","badge":1,"title":"Ingresso Alarm (4438)","data":{"eid":"4438","mid":"1","notification_foreground":"true"}} to token: ...hNxOhN
DBG-1:2022-08-21,00:15:19 |----> FORK:Monitor 1, eid:4438 fcmv1: FCM push message error 
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>500 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered an error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>

DBG-2:2022-08-21,00:15:19 |----> FORK:Monitor 1, eid:4438 child finished writing to parent
DBG-2:2022-08-21,00:15:21 PARENT: ----------> Tick START (active forks:1, total forks:1, active hooks: 0 running for:1 min)<--------------
DBG-2:2022-08-21,00:15:21 PARENT: After tick: TOTAL: 1,  ES_CONTROL: 0, FCM+WEB: 0, FCM: 1, WEB: 0, MQTT:0, invalid WEB: 0, PENDING: 0
DBG-2:2022-08-21,00:15:21 PARENT: GOT JOB==> update badge to 1, count to 177 for: ...hNxOhN, at: 7
DBG-2:2022-08-21,00:15:21 PARENT: Job: Update last sent timestamp of monitor:1 to 1661033718.68254 for id:1661033701.66854
DBG-2:2022-08-21,00:15:21 PARENT: There are 1 active child forks & 0 zm_detect processes running...
DBG-2:2022-08-21,00:15:21 PARENT: We've already worked on Monitor:1, Event:4438, not doing anything more

Thanks!

baudneo commented 2 years ago

Cloud zmninja notifications are done. You can set use_fcmv1=no and that may fix your issue for notifications for the time being until zoneminder team released their version of zmninja with their cloud function.