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

Fix missing upload status header in resumable upload finalise response #4407

Merged
merged 2 commits into from Apr 6, 2022

Conversation

tohhsinpei
Copy link
Member

@tohhsinpei tohhsinpei commented Apr 6, 2022

Description

Issue

This PR fixes #4346, #4364, and #4396.

Any large (> ~500kB) upload to the Storage Emulator gives a console error.

On web:

Uncaught (in promise) FirebaseError: Firebase Storage: An unknown error occurred, please check the error payload for server response. (storage/unknown)

On iOS:

2022-03-31 16:50:05.822789-0400 Example[51380:621771] offset 438491 exceeds data length 438491
2022-03-31 16:50:05.823434-0400 Example[51380:622628] Range invalid for upload data.  offset: 438491	length: 8491	dataLength: 438491	expected UploadLength: 438491
2022-03-31 16:50:08.017868-0400 Example[51380:622083] [javascript] Possible Unhandled Promise Rejection (id: 0):

On the emulator UI, the upload is shown with a loading spinner indefinitely. However, on refresh we see that the file was in fact uploaded successfully.

This issue started in v10.3.0.

Cause

In #4250 we refactored the upload logic. In doing so we forgot to include the header X-Goog-Upload-Status with value final in the response for the finalize request. My guess is that the client expects to make further upload requests and errors out when there are no more bytes to upload.

Scenarios Tested

Tested on web and verified that console error no longer appears and that the header is included in the response. Also included a check for the latter in an existing integration test for resumable uploads.

@tohhsinpei tohhsinpei changed the title Fix missing upload status heade in resumable upload finalise response Fix missing upload status header in resumable upload finalise response Apr 6, 2022
@tonyjhuang
Copy link
Contributor

Wow nice find! Do we need to do this in gcloud.ts as well?

@tohhsinpei
Copy link
Member Author

Wow nice find! Do we need to do this in gcloud.ts as well?

No... The way the Admin SDK does it is a bit different. It'll just be one POST to start then one PUT to upload and finalise.

@tonyjhuang
Copy link
Contributor

SGTM thanks for the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error uploading large files to emulator storage since 10.3.0
2 participants