firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

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

Open braadworst opened this issue 2 years ago • 1 comments

[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

braadworst avatar Sep 08 '22 04:09 braadworst

Hi @braadworst can you provide a repro?

tonyjhuang avatar Oct 07 '22 19:10 tonyjhuang

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!

google-oss-bot avatar Oct 18 '22 01:10 google-oss-bot

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

tonyjhuang avatar Oct 20 '22 15:10 tonyjhuang