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

When uploading from the browser, the onProgress is not called. #32247

Open
6 tasks
genu opened this issue Dec 16, 2024 · 3 comments
Open
6 tasks

When uploading from the browser, the onProgress is not called. #32247

genu opened this issue Dec 16, 2024 · 3 comments
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)

Comments

@genu
Copy link

genu commented Dec 16, 2024

  • Package Name: @azure/storage-file-datalake
  • Package Version: 12.25.0
  • Operating system: OSx
  • nodejs
    • version: v22.5.1
  • browser Arc/Chrome
    • name/version:
  • typescript
    • version: 5.6.3
  • Is the bug related to documentation in

Describe the bug
The onProgress doesn't get called when uploading from the browser using DataLakeFileClient.upload(...). It gets called a single time at the end of an upload.

To Reproduce

  let dir = new DataLakeDirectoryClient(sasUrl)
  const fileClient = dir.getFileClient('test.mp4')

  await fileClient.upload(file, {
     onProgress: ({ loadedBytes }) => {
        console.log("loadedBytes", loadedBytes)
     },
  })

Expected behavior
I expect that I would see a console.log as the file is uploaded from the browser.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
The current behavior is that the onProgress is called a single time at the end of an upload. There is no way to implement an upload progress bar without this callback functioning properly.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Dec 16, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

@github-actions github-actions bot added Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels Dec 16, 2024
@jeremymeng
Copy link
Member

It is a limitation of the fetch() API. As far as I know, onUploadProgress only works on Chrome-based browsers if the request body is a ReadableStream<Uint8Array>.

onUploadProgress may work for Blob and ArrayBuffer if you use an XHR http client. For example, you can adapt the following file to your needs https://github.com/Azure/azure-sdk-for-js/blob/7eb9ca14aecf5cc1907808fd58b5dbb7cbcfddd7/sdk/core/core-rest-pipeline/src/xhrHttpClient.ts,

and pass it via the DataLakeDirectoryClient

// httpClient: MyHTTPClient, // A customized HTTP client implementing IHttpClient interface

@xirzec xirzec added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Dec 20, 2024
@github-actions github-actions bot removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Dec 20, 2024
Copy link

Hi @genu. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

3 participants