@uppy/aws-s3: missing eTag prevents file upload completion when using GCS
Initial checklist
- [X] I understand this is a bug report and questions should be posted in the Community Forum
- [X] I searched issues and couldn’t find anything (or linked relevant results below)
Link to runnable example
No response
Steps to reproduce
- set up AwsS3 but use GCS as drop-in replacement
- 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.
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 };
}
I'm experiencing the same missing ETag error in @uppy/aws-s3: 4.2.3 when uploading to Backblaze B2 through the S3 compatible API even with the CORS settings on the bucket exposing ETag headers
Have you seen https://github.com/transloadit/uppy/issues/5687#issuecomment-2920352792 regarding case sensitivity with CORS policy headers?
As i am facing the same issue with GCS, the Etag hack seems not working mentioned in comment. Because Etag is not a valid value i think.
bellow i am getting from the gcs response, keep in mind this is in response there is no Etag header for the request
<PostResponse> <Location>location-url</Location> <Bucket>bucketname</Bucket> <Key>key-value</Key> <ETag>"Tag value"</ETag> </PostResponse>