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

@uppy/aws-s3: missing eTag prevents file upload completion when using GCS #5594

Open
2 tasks done
pxue opened this issue Jan 10, 2025 · 1 comment
Open
2 tasks done
Labels

Comments

@pxue
Copy link

pxue commented Jan 10, 2025

Initial checklist

  • I understand this is a bug report and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Link to runnable example

No response

Steps to reproduce

  1. set up AwsS3 but use GCS as drop-in replacement
  2. upload from local file

Expected behavior

Upload expects to complete successfully AND event completes

Actual behavior

Upload completes fine but onComplete is not called because missing etag shortcircuits the function

From GCS:
https://cloud.google.com/storage/docs/metadata

Etag is not expected to return unless using XML API. While I can copy/paste the provider, this should work with GCS as well.

@pxue pxue added the Bug label Jan 10, 2025
@pxue
Copy link
Author

pxue commented Jan 10, 2025

The intermediate fix is to just clone the entire AwsS3 provider and implement it myself

instead of parsing eTag / location from the header, it's parsed from the response body

  static parseXMLResponse(xml: string | null) {
    if (!xml) {
      return {};
    }
    const parser = new DOMParser();
    const doc = parser.parseFromString(xml, "application/xml");
    const etag = doc.querySelector("PostResponse ETag")?.textContent;
    const location = doc.querySelector("PostResponse Location")?.textContent;
    return { etag, location };
  }

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

1 participant