Hi,
I have installed TagoIO relay and Mosquitto broker on an AWS EC2 instance, and am using DNS service.
I am able to forward MQTT uplinks from my device to TagoIO using this setup, but am not able to get downlinks through.
I made this test script:
**********************************************
import { Analysis, Network } from “jsr:@tago-io/sdk”;
const network = new Network({
token: “9c0c4050-d679-47aa-a*********”,
});
async function run(context) {
// Publish to Relay: topic and payload for your external broker
await network.publishToRelay({
device: “68c91a3d19a78f*******”,
topic: “device/down/1026”,
message: “test”,
options: { qos: 0 }, // optional
});
console.log(“Published via Relay”);
}
Analysis.use(run);
*******************************************************************************
The log shows this result:
******************************************************************************
[2025-10-28 14:21:47] Starting Analysis…
[2025-10-28 14:21:47] error: Uncaught (in promise) “Error on Relay: Request failed with status code 404 Not Found: https://test1395.xxxxx.xxx/publish”
[2025-10-28 14:21:47] [TagoIO Analysis] Error executing Deno analysis: 1
*******************************************************************************
I see that the network middleware is correct (test1395.xxxxx.xxx), but would have expected the port 3001 to be included, otherwise it will not reach the relay, I think?
In another script and from postman I tested a direct fetch on https://test1395.xxxxx.xxx:3001/publish when setting the relay in unsafe mode, and then the relay receives the downlink.
If I try to set the middleware address in the network to test1394.xxxxx.xxx:3001, it will not save.
Could it be that there is an issue in the publishToRelay() function, such that it fails to include the port 3001?