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

Files bigger than 256kb fail when saving to storage emulator #4927

Closed
Gremash opened this issue Aug 26, 2022 · 7 comments
Closed

Files bigger than 256kb fail when saving to storage emulator #4927

Gremash opened this issue Aug 26, 2022 · 7 comments
Assignees

Comments

@Gremash
Copy link

Gremash commented Aug 26, 2022

[REQUIRED] Environment info

firebase-tools: 11.8.0
firebase NPM package: firebase@9.9.3

Platform: macOS Monterey, MacBook Pro 2021 w/ Apple M1 Pro chip

[REQUIRED] Test case

Upload a file larger than 256kb using the Javascript SDK to the Firebase Storage emulator

[REQUIRED] Steps to reproduce

While using the storage emulator and the Firebase JavaScript SDK, upload any file larger than 256kb. The following error occurs: Firebase Storage: An unknown error occurred, please check the error payload for server response. (storage/unknown). No other information is provided and no logs are recorded. This error does not happen when using production Firebase Cloud Storage. Files smaller than 256kb do not fail. Also, files larger than 256kb can be manually uploaded via the emulator UI.

Here is the sample code:

const storageRef = ref(storage, `temp/${file.name}`);

const uploadTask = uploadBytesResumable(storageRef, file);

uploadTask.on(
      'state_changed',
      (snapshot) => {
        const percent = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
        setUploadPercent(percent);
      },
      (error) => { // ERROR OCCURS HERE
        setDisplayedPrompt(error.message);
        setUploading(false);
      },
    );

[REQUIRED] Expected behavior

Users can uploaded files larger than 256kb while using the emulator.

[REQUIRED] Actual behavior

Any file larger than 256kb causes the firebase storage emulator to throw an unknown error.

@Gremash Gremash added the bug label Aug 26, 2022
@mandalornl
Copy link

I'm experiencing the same problem.

@michael-freling
Copy link

I got the same error Firebase Storage: An unknown error occurred, please check the error payload for server response. (storage/unknown) without any server response on the same version using uploadBytesResumable function.
When I downgraded the version of firebase-tools to 11.7, the error didn't happen.

I am not sure my issue exactly the same cause, though. I couldn't fix my code when I reduced the file size less than 256KB.

@peteshilling
Copy link

peteshilling commented Sep 1, 2022

I've started experiencing the same problem as Gremash the last day or so. Was using firebase-tools 11.2, now using 11.8 (experiencing the problem with both). I recently updated the gcloud cli, I'm not sure if that could be related.

@willhackett
Copy link

We're seeing this issue too. Looks like a regression of #4407

@macksal
Copy link

macksal commented Sep 2, 2022

Same issue when running tests in my dev and CI environments. It comes up only for larger blobs.

I've also noticed that the corresponding file is created (visible in the storage emulator UI) but it's only about 260KB, and the content type is application/octet-stream rather than the content type of the object that's actually being uploaded.

Reverting to firebase-tools 11.7 is a workaround.

@braadworst
Copy link

Having this issue as well

@Yuangwang
Copy link
Contributor

Thanks for your patience everyone, I merged in a fix for this #5018. I'm closing this for now but please be sure to try it out once the new release is out and report back if there are any issues, we can reopen and take another look if needed then.

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

No branches or pull requests

10 participants