We are experiencing a failure in sending IOT direct calls to iot devices, even though we see the device receives the command

Jonathan Volij 5 Reputation points
2025-05-28T08:03:18.54+00:00

We are experiencing errors in the backend when sending iot direct methods, even though we see that the device does receive the direct method call and responds correctly.

From device logs:

28-05-2025 07:37:41.300000: IoT open door command received: [object Object]

From the backend logs:
5/28/2025, 7:37:41.226 AM
Error: Not found at RestApiClient.translateError (/home/site/wwwroot/node_modules/azure-iothub/dist/common-http/rest_api_client.js:282:29) at requestCallback (/home/site/wwwroot/node_modules/azure-iothub/dist/common-http/rest_api_client.js:184:40) at IncomingMessage.<anonymous> (/home/site/wwwroot/node_modules/azure-iothub/dist/common-http/http.js:117:17) at IncomingMessage.emit (node:events:536:35) at endReadableNT (node:internal/streams/readable:1698:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { response: <ref *1> IncomingMessage { _events: { close: undefined, error: [Function (anonymous)], data: [Function (anonymous)], end: [Array], readable: undefined }, _readableState: ReadableState { highWaterMark: 16384, buffer: [], bufferIndex: 0, length: 0, pipes: [], awaitDrainWriters: null, [Symbol(kState)]: 194512764 }, _maxListeners: undefined, socket: null, httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [ 'content-length', '348', 'content-type', 'application/json; charset=utf-8', 'iothub-errorcode', 'DeviceNotOnline', 'date', 'Wed, 28 May 2025 07:37:40 GMT' ], rawTrailers: [], joinDuplicateHeaders: undefined, aborted: false, upgrade: false, url: '', method: null, statusCode: 404, statusMessage: 'Not Found', {\"errorCode\":404103,\"message\":\"The operation failed because the requested device isn't online.

Seems that rebooting the device fixes the issue, but not clear how come the device gets the call but the backend thinks its offline

This is the code that is triggered, really simple

    openDoorCommand = function(request, response) {
        track('IoT open door command received: ' + request.payload);
        metric("remote-open-door",1);
        openDoor();
        response.send(200, 'Opening door');
    }
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 36,941 Reputation points MVP Volunteer Moderator
    2025-05-28T10:51:31.0266667+00:00

    Hello @Jonathan Volij ,

    welcome to this moderated Azure community forum.

    The message error is documented. Please double check if the right direct method is called (by default, these direct method names are case sensitive).

    If the problem keeps occurring, consider requesting a support ticket to the Q and A team here so that they can take a look at the details in their backend.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.