Devices get connected and disconnected after enable notifications.

maclofin6 months ago

I have a issue, when I try to enable traccar notification to send alarms and events to the mobile app, the server hang up and all devices are disconnected

This is the logs when I enable a notifications and the device(s) trigger a alarm/event.

2024-06-09 00:00:01  INFO: [Td6369900: startek < 147.75.51.166] 26264f3135372c3836353233353035373338303630382c3030302c302c2c3234303630393032303135352c412c31392e3433373034352c2d37302e3039333634352c31342c302e392c302c31372c38352c3230373330382c3337307c317c313737317c30303036303946322c31312c30303030303033442c30302c30302c303446437c303139467c303030307c303030302c312c3031303030307c3032303030302c2c45450d0a
2024-06-09 00:00:01  INFO: Event id: 865235057380608, time: 2024-06-09 00:00:01, type: deviceOnline, notifications: 1
2024-06-09 00:00:01  INFO: [Td6369900] error - Failed to get notificator  - RuntimeException (NotificatorManager:75 < NotificationManager:127 < ... < *:124 < ... < *:123 < *:163 < ConnectionManager:256 < ...)
2024-06-09 00:00:01  INFO: [Td6369900] disconnected
2024-06-09 00:00:01  INFO: Event id: 865235057380608, time: 2024-06-09 00:00:01, type: deviceOffline, notifications: 1
2024-06-09 00:00:01  INFO: [Td6369900] error - Failed to get notificator  - RuntimeException (NotificatorManager:75 < NotificationManager:127 < ... < *:124 < ... < *:123 < *:163 < ConnectionManager:256 < ...)
2024-06-09 00:00:01  WARN: Event forwarding failed - HTTP code 400 - RuntimeException (EventForwarderJson:57 < *:50 < ...)
2024-06-09 00:00:01  WARN: Event forwarding failed - HTTP code 400 - RuntimeException (EventForwarderJson:57 < *:50 < ...)
2024-06-09 00:00:04  INFO: [T413eb7ec] connected
2024-06-09 00:00:05  INFO: [T413eb7ec: startek < 147.75.51.166] 2626503135372c3836353233353035373338303630382c3030302c302c2c3234303630393032303235362c412c31392e3433373034352c2d37302e3039333634352c31342c302e392c302c31372c38352c3230373330382c3337307c317c313737317c30303036303946322c31312c30303030303033442c30302c30302c303446437c303139457c303030307c303030302c312c3031303030307c3032303030302c2c46300d0a
2024-06-09 00:00:05  INFO: Event id: 865235057380608, time: 2024-06-09 00:00:05, type: deviceOnline, notifications: 1
2024-06-09 00:00:05  INFO: [T413eb7ec] error - Failed to get notificator  - RuntimeException (NotificatorManager:75 < NotificationManager:127 < ... < *:124 < ... < *:123 < *:163 < ConnectionManager:256 < ...)
2024-06-09 00:00:05  INFO: [T413eb7ec] disconnected

the test notification works well.

I have enable theses

Screenshot 2024-06-10 144001.png

I had the traccar.xml configured with my token and all good but I not understand why it happens.

Anton Tananaev6 months ago

Looks like something is misconfigured.

maclofin6 months ago

its possible, but with this logging info I couldn't get what is misconfigured

    <entry key='database.driver'>org.h2.Driver</entry>
    <entry key='database.url'>jdbc:h2:./data/database</entry>
    <entry key='database.user'>sa</entry>
    <entry key='database.password'></entry>
    <entry key='notificator.types'>traccar,web</entry>
    <entry key='notificator.traccar.key'>{myToken}</entry>
    <entry key='event.forward.type'>json</entry>
    <entry key='event.forward.exchange'>traccar</entry>
    <entry key='event.forward.topic'>events</entry>
    <entry key='event.forward.url'>https://myWebSite.com/client/api/v1/events</entry>
    <entry key='event.forward.header'>X-secret:mySecret</entry>

</properties>

Another question, Anton, with this commit now is able to read-only user have notificationTokens without need of administrator privileges?
https://github.com/traccar/traccar/commit/2147ecb2d9fe0fb49b3f03dc650bc363e72e3fd2

Anton Tananaev6 months ago

Notification channel is misconfigured.

Yes, read-only users will be able to configure notification tokens.

maclofin6 months ago

1- I cannot spot the misconfiguration, I follow the notification docs, I read others forum post about that
For example, these are the two parameters that I have, following theses steps

Screenshot 2024-06-11 001634.png

2- regarding the read-only can configure notification tokens, I just downloaded and install the latest version on Traccar and test with a read-only user and the read-only user cannot configure notifications tokens yet.

Anton Tananaev6 months ago
  1. Check all the channel values you have in the database.
  2. When was the version released that you downloaded and when was the commit?
maclofin6 months ago

1- I have checked the notificators/notifications values and all seems ok (I don't see any channel value, just notification)

Screenshot 2024-06-11 123137.png
Screenshot 2024-06-11 123231.png
Screenshot 2024-06-11 123406.png

2- the commit was 2 days ago, yesterday I downloaded and upgrade traccar from the master repo that inclue the commit and didn't create a notificationToken when readonly user.

Anton Tananaev6 months ago
  1. You're looking at the wrong tables.
  2. Probably you didn't upgrade something correctly. I recommend waiting for the official release.