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

Requested files stored in the firebase storage emulator as gzip are always fetched uncompressed #4957

Closed
braadworst opened this issue Sep 8, 2022 · 3 comments · Fixed by #5185

Comments

@braadworst
Copy link

[REQUIRED] Environment info

firebase-tools: 11.8.0

Platform: MacOS (11.5.2), Chrome (104.0.5112.101)

[REQUIRED] Test case

Doesn't apply

[REQUIRED] Steps to reproduce

  • Save a compressed file to the storage emulator from a cloud function
  • Request the file via fetch from the client
  • Observe the returned content-encoding, this is set to identity

[REQUIRED] Expected behavior

Files should be fetched as gzipped files instead of uncompressed files, the content-encoding header on the response should be gzip

[REQUIRED] Actual behavior

When I save a file via my cloud function as a gzipped compressed version it saves it correctly as a compressed file in the storage emulator. But when I then request my file in the frontend via the native fetch API it always respond with the uncompressed version. The response header content-encoding is always set to identity. According to the docs here when the file is stored compressed (that is the case) and the request has the accept-encoding set to gzip (this is the case, this is controlled by the browser and actually set to gzip, deflate, br) it should return compressed.

I've uploaded a compressed file to the actual production bucket and fetched it, and in that case it was working as expected.

Final note, as my file is created in a cloud function and I need the getDownloadUrl that you normally receive when uploading a file from the client I had to use a workaround as described here and addressed here. I am building a custom url by setting the firebaseStorageDownloadTokens . I don't expect this to influence the situation by I've added it for full disclosure

Thank you

@tonyjhuang
Copy link
Contributor

Hi @braadworst can you provide a repro?

@google-oss-bot
Copy link
Contributor

Hey @braadworst. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@tonyjhuang tonyjhuang removed Needs: Author Feedback Issues awaiting author feedback no-recent-activity labels Oct 20, 2022
@tonyjhuang
Copy link
Contributor

I've been able to reproduce this and am working on a fix now.

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

Successfully merging a pull request may close this issue.

5 participants