azure-sdk-for-js: AbortError when running Azure nodejs app locally

Something in my initialization is causing an AbortError that gives no information about the cause, what was aborted.

21 |  * }
22 |  * ```
23 |  */
24 | class AbortError extends Error {
25 |     constructor(message) {
26 |         super(message);
             ^
AbortError: The operation was aborted.
      at new AbortError (app_root\node_modules\@azure\core-rest-pipeline\node_modules\@azure\abort-controller\dist\commonjs\AbortError.js:26:9)
      at app_root\node_modules\@azure\core-rest-pipeline\dist\commonjs\nodeHttpClient.js:55:33
      at abort (native:1:1)
      at app_root\node_modules\@azure\core-rest-pipeline\dist\commonjs\nodeHttpClient.js:177:26

I’ve had this issue come and go as things change and root cause is likely a problem in network/RBAC rules, something gets a 403 or similar. The problem really is that I’ve not found a way to find the cause. None of my error checking triggers. I’ve tried to try-catch-everything. And all the code seems to work (vaults/DB return data as should). Also when run in Azure it works (but it’s a big hurdle if can’t run locally). So my question really is how to troubleshoot this (and maybe hope that there’d be better errors).

Azure objects created in the initialization:

  • DefaultAzureCredential (using my az cli identity)
  • SecretClient (secret fetched)
  • QueueClient (no messages sent/received)
  • EmailClient (no messages sent)
  • Sql Server connection

Azure packages in the app “@azure/communication-email”: “^1.0.0”, “@azure/identity”: “^4.5.0”, “@azure/keyvault-secrets”: “^4.9.0”, “@azure/storage-queue”: “^12.25.0”, “mssql”: “^11.0.1”

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Most upvoted comments

For anyone else having this error it seems to be related to using the DefaultAzureCredential locally. In order to work around the issue I’ve started doing something like this:

const cred = process.env.NODE_ENV !== 'production' ? new AzureCliCredential() : new DefaultAzureCredential();

const pipeline = newPipeline(cred);

const blobServiceClient = new BlobServiceClient(
  `https://<myStorageAccountName>.blob.core.windows.net`,
  pipeline,
);