Hello everybody! I use SMS notifications to trigger other APIs like WhatsApp for example, in previous versions, 5.9 for example everything worked perfectly. After upgrading to version 6.5, I'm getting this error every time a notification is triggered:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>SyntaxError: Unexpected token <br> in JSON at position 51<br> at JSON.parse (<anonymous>)<br> at parse (/opt/1015/node_modules/body-parser/lib/types/json.js:92:19)<br> at /opt/1015/node_modules/body-parser/lib/read.js:128:18<br> at AsyncResource.runInAsyncScope (node:async_hooks:203:9)<br> at invokeCallback (/opt/1015/node_modules/raw-body/index.js:238:16)<br> at done (/opt/1015/node_modules/raw-body/index.js:227:7)<br> at IncomingMessage.onEnd (/opt/1015-/node_modules/raw-body/index.js:287:7)<br> at IncomingMessage.emit (node:events:517:28)<br> at endReadableNT (node:internal/streams/readable:1400:12)<br> at process.processTicksAndRejections (node:internal/process/task_queues:82:21)</pre> </body> </html> - MessageException (HttpSmsClient:99 < NotificatorSms:48 < Notificator:39 < NotificationResource:107 < ...)
My XML configuration looks like this:
<entry key='notificator.types'>web,sms</entry>
<entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
<entry key='sms.http.url'>http://my-ip:1015/send-message</entry>
<entry key='sms.http.template'>{"number": "{phone}","message": "{message}"}</entry>
Any tips on what might be happening? Remembering that this worked perfectly in previous versions.
Thanks
Your API returned an error.
Did anything change in the body of the sending message? Json to HTML Example. The error indicates that traccar is returning html data and not json.
No, that's not what the error indicates.
Hello everybody! I use SMS notifications to trigger other APIs like WhatsApp for example, in previous versions, 5.9 for example everything worked perfectly. After upgrading to version 6.5, I'm getting this error every time a notification is triggered:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Error</title> </head> <body> <pre>SyntaxError: Unexpected token <br> in JSON at position 51<br> at JSON.parse (<anonymous>)<br> at parse (/opt/1015/node_modules/body-parser/lib/types/json.js:92:19)<br> at /opt/1015/node_modules/body-parser/lib/read.js:128:18<br> at AsyncResource.runInAsyncScope (node:async_hooks:203:9)<br> at invokeCallback (/opt/1015/node_modules/raw-body/index.js:238:16)<br> at done (/opt/1015/node_modules/raw-body/index.js:227:7)<br> at IncomingMessage.onEnd (/opt/1015-/node_modules/raw-body/index.js:287:7)<br> at IncomingMessage.emit (node:events:517:28)<br> at endReadableNT (node:internal/streams/readable:1400:12)<br> at process.processTicksAndRejections (node:internal/process/task_queues:82:21)</pre> </body> </html> - MessageException (HttpSmsClient:99 < NotificatorSms:48 < Notificator:39 < NotificationResource:107 < ...)
My XML configuration looks like this:
<entry key='notificator.types'>web,sms</entry> <entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry> <entry key='sms.http.url'>http://my-ip:1015/send-message</entry> <entry key='sms.http.template'>{"number": "{phone}","message": "{message}"}</entry>
Any tips on what might be happening? Remembering that this worked perfectly in previous versions.
Thanks