Closed bjoernsauer closed 1 year ago
Here is the plugin configuration file c8y-configuration-plugin.toml
# Add the configurations to be managed by c8y-configuration-plugin
files = [
{ path = '/etc/tedge/tedge.toml', user = 'tedge', group = 'tedge', type = 'tedge.toml' },
{ path = '/etc/tedge/mosquitto-conf/c8y-bridge.conf', type = 'c8y-bridge.conf' },
{ path = '/etc/tedge/mosquitto-conf/tedge-mosquitto.conf', type = 'tedge-mosquitto.conf' },
{ path = '/etc/mosquitto/mosquitto.conf', type = 'mosquitto.conf' },
{ path = '/etc/tedge/c8y/c8y-log-plugin.toml', type = 'c8y-log-plugin.toml' }
]
It sounds like that the token is not being refreshed before the plugin tries to communicate with Cumulocity via the REST API.
@bjoernsauer How long as the agent service/s been running for? A few minutes, or much longer (e.g. a day or more)?
I reconnected the thin-edge.io agent at approx 2022-11-07T07:14:05.285Z this morning. That's what cumulocity shows me for "last actualization" time in the device info dashboard.
A 401 unauthorized response is due to the plugin using a JWT token that is expired. This can happen for two reasons:
c8y/s/dat
subscriptions even when not requested by the process itself.So to reproduce the issue:
c8y_configuration_plugin
but don't use it One way to reproduce the issue in a test environment is to publish fake tokens. Despite proper tokens being published on demand the plugin will try to use first the fake ones :-(.
c8y_configuration_plugin
but don't use it tedge mqtt pub c8y/s/dat '71,fake-expired-token'
A fix has been merged: https://github.com/thin-edge/thin-edge.io/pull/1586. The build is https://github.com/thin-edge/thin-edge.io/actions/runs/3478607077.
@gligorisaev please see my previous comment to test it.
Tested and it is fine
Will be included in the next release. 0.8.2
Describe the bug
Requesting a configuration file via cumulocity fails with the error reason "HTTP status client error (401 Unauthorized) for url (https://xxx)".
The log file of the c8y_configuration_plugin:
To Reproduce
Connect a device to cumulocity. Wait some time (several hours, sorry for no precise duration). Try to retrieve a configuration file from the device.
Expected behavior
the configuration file should be received.
Screenshots
Details of the cumulocity operation:
Environment (please complete the following information):