-
Notifications
You must be signed in to change notification settings - Fork 72
Cannot send configuration file to device when connecting c8y tenant with custom domain #3545
Description
I have a c8y tenant with custom domain. The thin-edge version 1.4.3~431+ga71fc39 is installed on my raspberry pi.
After setting the c8y.http to the custom domain and c8y.mqtt to .cumulocity.com, I can connect thin-edge to the platform without any warnings. The current configuration for this is as follows:
c8y.http=my.custom.domain.com:443
c8y.mqtt=t12345.cumulocity.com:8883
I can get configuration snapshot from the device. But when I try to send the configuration to the device I got the following error:
tedge-agent failed downloading a file: HTTP status client error (401 Unauthorized) for url (https://t12345.cumulocity.com
The payload of the send configuration operation is:
{ "delivery": { "log": [ { "time": "2025-04-08T17:12:32.273Z", "status": "PENDING" }, { "time": "2025-04-08T17:12:32.304Z", "status": "SEND" } ], "time": "2025-04-08T17:12:32.397Z", "status": "DELIVERED" }, "creationTime": "2025-04-08T17:12:32.183Z", "deviceId": "xxxxxx", "deviceName": "example48971", "failureReason": "tedge-agent failed downloading a file: HTTP status client error (401 Unauthorized) for url (https://t12345.cumulocity.com/inventory/binaries/xxxxxxx)", "self": "https://t12345.cumulocity.com/devicecontrol/operations/191367", "id": "191367", "status": "FAILED", "c8y_DownloadConfigFile": { "type": "tedge-configuration-plugin", "url": "https://t12345.cumulocity.com/inventory/binaries/xxxxxxx" }, "description": "Send configuration snapshot tedge-configuration-plugin of configuration type tedge-configuration-plugin to device example48971" }
The URL used by this operation is not the value of c8y.http, but the value of c8y.mqtt.
Similarly, I can't install apt packages that are stored in the software repository on this platform. Error is:
DownloadError error: "HTTP status client error (401 Unauthorized) for url (https://t12345.cumulocity.com/inventory/binaries/81183019)" for "https://t12345.cumulocity.com/inventory/binaries/81183019" Caused by: , see device log file /var/log/tedge/agent/workflow-software_update-c8y-mapper-191343.log
If a software is stored in the software repository with an empty software file path, installing software works fine. In this case, thin-edge won't need to download the software file from the platform.
So the problem seems to be that, when the c8y platform has a custom domain and thin-edge tries to download something from the platform, thin-edge will send http requests to the URL set by c8y.mqtt, but it should use the URL set by c8y.http.
Here are the other c8y configurations:
c8y.root_cert_path=/etc/ssl/certs
c8y.auth_method=certificate
c8y.credentials_path=/etc/tedge/credentials.toml
c8y.http=my.custom.domain.com:443
c8y.mqtt=t12345.cumulocity.com:8883
c8y.topics=["te/+/+/+/+", "te/+/+/+/+/twin/+", "te/+/+/+/+/m/+", "te/+/+/+/+/e/+", "te/+/+/+/+/a/+", "te/+/+/+/+/status/health"]
c8y.device.id=example48971
c8y.device.key_path=/etc/tedge/device-certs/tedge-private-key.pem
c8y.device.cert_path=/etc/tedge/device-certs/tedge-certificate.pem
c8y.device.csr_path=/etc/tedge/device-certs/tedge.csr
c8y.smartrest.templates=["custom_devmgmt"]
c8y.smartrest.use_operation_id=true
c8y.smartrest1.templates=[]
c8y.enable.log_upload=true
c8y.enable.config_snapshot=true
c8y.enable.config_update=true
c8y.enable.firmware_update=true
c8y.enable.device_profile=true
c8y.mapper.mqtt.max_payload_size=16184
c8y.proxy.bind.address=127.0.0.1
c8y.proxy.bind.port=8001
c8y.proxy.client.host=127.0.0.1
c8y.proxy.client.port=8001
c8y.bridge.topic_prefix=c8y
c8y.bridge.keepalive_interval=60s
c8y.bridge.include.local_cleansession=auto
c8y.entity_store.auto_register=true
c8y.entity_store.clean_start=true
c8y.software_management.api=legacy
c8y.software_management.with_types=false
c8y.operations.auto_log_upload=on-failure
c8y.availability.enable=true
c8y.availability.interval=60m