Azure / azure-iot-sdk-node

A Node.js SDK for connecting devices to Microsoft Azure IoT services
https://docs.microsoft.com/en-us/azure/iot-hub/
Other
261 stars 227 forks source link

notifyUploadBlobStatus API giving Bad request error #969

Closed shivupatil2090 closed 3 years ago

shivupatil2090 commented 3 years ago

I have an application which uploads files to azure storage blob. I upload 7 files parallelly. And all 7 files are getting uploaded to storage blob. But notifyUploadBlobStatus is failing for few the files with Bad request error.

SDK version : 1.17.0-lts0720up1.

My application code looks like

getSharedAccessSignature(File)
  .then(sharedAccessSignature => {
    blobCorrelationId = sharedAccessSignature.correlationId;
    return uploadToBlob(message.fromFile, sharedAccessSignature);
  })
  .then(
    notifyBlobUploadStatus(
      blobCorrelationId,
      true,
      201,
      ''
    )
  )
  .then(() => {
    log(`{ upload successful`);
  })
  .catch(error => {
    log(`File upload failed: ${error}`);
  });

This is the stack trace of the error error: Encountered unrecoverable error: Error: Bad Request and error stack is Error: Bad Request at IncomingMessage. (/app/node_modules/azure-iot-device/node_modules/azure-iot-http-base/dist/http.js:116:21) at IncomingMessage.emit (events.js:203:15) at endReadableNT (_stream_readable.js:1145:12) at process._tickCallback (internal/process/next_tick.js:63:19)

anthonyvercolano commented 3 years ago

I would suggest enabling debugs. on linux: export DEBUG="azure" would normally get you all of the sdk's messages (Not sure about the storage sdk. You could try doing DEBUG="". You'll get quite a bit more at the beginning?

If you do them sequentially do you still get an error?

anthonyvercolano commented 3 years ago

We haven't heard from you in a while. Closing this issue. Feel free to re-open if necessary.