Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.07k stars 1.19k forks source link

Expected signal to be an instanceof AbortSignal - azure/storage-blob #28059

Open priyanshusingh18 opened 10 months ago

priyanshusingh18 commented 10 months ago

Describe the bug Getting TypeError: Expected signal to be an instanceof AbortSignal on uploading anything to blob storage in production build. It is working fine in development. Error only comes in bundle.

To Reproduce Steps to reproduce the behavior:

  1. create app using create-next-app,
  2. use azure blob storage library to upload anything
  3. bundle it, and try to upload some file.

Expected behavior To upload to cloud

code

  const blobServiceClient = BlobServiceClient.fromConnectionString(
    process.env.AZURE_STORAGE_KEY!
  );
const containerClient = blobServiceClient.getContainerClient(containerName);
  const blobName = fileName.toLowerCase() + new Date().getTime();
  const blockBlobClient = containerClient.getBlockBlobClient(blobName);
  const uploadResponse = await blockBlobClient.uploadData(bytes)
LizDodion commented 10 months ago

also getting the same error. when i run it locally after a couple of rebuilds it works but not in my CI or deployed vercel app. it only became an error when i upgrade nextjs to v14.0.4

dmitryshostak commented 10 months ago

Facing the same issue on Next v14.0.4 on vercel (locally works fine). v14.0.3 and lower works as expected. Please resolve the issue ASAP. It's a blocker for us.

telegram-cloud-photo-size-2-5202106754928857857-y

xirzec commented 9 months ago

I am curious if our recent work to remove our AbortSignal polyfill in core would resolve this issue, assuming we adopted the new major of @azure/abort-controller in storage-blob

EmmaZhu commented 9 months ago

Hi @xirzec ,

storage-blob has ready used latest @azure/abort-controller@1.1.0. Seems @azure/abort-controller@2.0.0 has not been released yet..

I tried to upgrade to latest node-fetch, but got another issue:

Expected signal to be an instanceof AbortSignal or EventTarget

EmmaZhu commented 9 months ago

Hi @xirzec ,

I tried to build a @azure/abort-controller from main branch and install it to @azure/storage-blob on stable branch, but got a circular dependency failure. Can you help to cherry-pick the poly fill change to storage/stable branch? I'll have a try with it again later.

jeremymeng commented 9 months ago

@EmmaZhu I will port the change to storage/stable branch.

jeremymeng commented 9 months ago

@EmmaZhu I've updated core-http and storage-blob to depend on abort-controller v2 alpha on top of storage/stable: https://github.com/jeremymeng/azure-sdk-for-js/tree/ac-v2-alpha. We haven't released abort-controller v2 but plan to do so. Please give it a try.

In an earlier try I've also done cherry picking the changes into storage/stable but I think the above approach is better. https://github.com/jeremymeng/azure-sdk-for-js/tree/storage/port-ac-v2

EmmaZhu commented 9 months ago

Hi @jeremymeng , I tried to upgrade to @azure/abort-controller@2.* in blob package. Seems @azure/core-http still has dependency on @azure/abort-controller@1.* which seems still cause the issue. We may also need to upgrade @azure/abort-controller in @azure/core-http

jeremymeng commented 9 months ago

@EmmaZhu yes I upgraded it in core-http to "dev" and now "^2.0.0" in my branch https://github.com/jeremymeng/azure-sdk-for-js/tree/ac-v2-alpha. I can publish new version of core-http shortly.

gbsmith commented 8 months ago

FWIW, I encountered this error when trying to upload an Az Storage Blob in a GH Action and then I added --keep-names option to esbuild in my package.json as per the comment at the bottom of this SO post and it started working.

Enngage commented 8 months ago

This also happens when using the Angular 17, SSR. It's sad because Angular doesn't currently have a good solution to apply a workaround for this.

dmitrc commented 8 months ago

Are there any updates on this?

fabio-nettis commented 7 months ago

Installing the current beta version 12.23.0-beta.1 resolved the issues for me.

compulim commented 3 months ago

@jeremymeng any chances to publish the fixed @azure/core-http?

The current version is 3.0.4 and released 8 months ago, still depending on @azure/abort-controller@~1.0.0.

jeremymeng commented 3 months ago

@compulim our latest storage packages have been migrated off @azure/core-http and we will deprecate @azure/core-http soon so it will not be updated any more. I have a new PR for moving storage packages to @azure/abort-controller v2 https://github.com/Azure/azure-sdk-for-js/pull/29808