Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getBlobSharedAccessSignature calls on device_client.js failing with connection timeout error behind a corporate HTTP proxy. #925

Closed
ksin63 opened this issue Feb 3, 2021 · 3 comments
Labels

Comments

@ksin63
Copy link

ksin63 commented Feb 3, 2021

As an alternate to uploadToBlob method to save SAS token quota from IotHub. I am directly using getBlobSharedAccessSignature and notifyBlobUploadStatus method to control when to acquire token or reuse existing token in case of file upload failure/retry scenario. My workflow is described below

  1. Use IoT SDK to acquire SAS token:
  2. Use Azure Storage SDK to upload file:
  3. Again use IoT SDK to notify IoT Hub about success or failure:

This works perfectly in normal environment with edge having direct internet connectivity, though it fails when the edge-proxy is running behind the corporate firewall with below error.
Encountered unrecoverable error: Error: connect ETIMEDOUT 13.79.172.43:443

After a quick glance on the source code it seems the developer in this PR-Add proxy support to blob file upload in Device SDK missed to apply setOptions for FileUploadApi.

A quick fix should go as below

setOptions(options: DeviceClientOptions, done?: Callback<results.TransportConfigured>): Promise<results.TransportConfigured> | void {
    if (!options) throw new ReferenceError('options cannot be falsy.');
    if (this._blobUploadClient) {
      /*Codes_SRS_NODE_DEVICE_CLIENT_99_103: [The `setOptions` method shall set `blobUploadClient` options.]*/
      this._blobUploadClient.setOptions(options);
    }
    /* Implicit call of setOption for fileUploadApi here*/
    if (this._fileUploadApi) {
       /* [The `setOptions` method shall set `fileUploadApi` options.]*/
       this._fileUploadApi.setOptions(options);
    }
    return super.setOptions(options, done);
  }
@ksin63 ksin63 added the bug label Feb 3, 2021
abossard pushed a commit to abossard/azure-iot-sdk-node that referenced this issue Feb 3, 2021
@abossard
Copy link
Contributor

abossard commented Feb 3, 2021

Would it be possible to backport the fix also to version 1.17.0-lts0720up1?

@YoDaMa
Copy link
Contributor

YoDaMa commented Feb 3, 2021

@abossard we unfortunately only backport security issue patches to LTS releases. Bug fixes like this are the purpose of the main branch.

@anthonyvercolano
Copy link
Contributor

@abossard Is this blocking production?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants