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

Uploading a .png image with .putData() creates an octet-stream object instead of a png object in storage emulator

Open Wizzel1 opened this issue 2 years ago • 4 comments

[REQUIRED] Environment info

firebase-tools: 11.9.0

Platform: Windows 10

[REQUIRED] Steps to reproduce

  1. Create an app that has access to the emulator.
  2. Convert a png image to bytes
  3. Upload the data with .putData(data, SettableMetadata(contentType: 'image/png'));
  4. Check the result in storage emulator

[REQUIRED] Expected behavior

As in version 11.7.0, I expected to have a image/png object added to the storage emulator.

[REQUIRED] Actual behavior

Instead it adds a application/octet-stream.

Wizzel1 avatar Sep 15 '22 17:09 Wizzel1

This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Sep 15 '22 17:09 google-oss-bot

what sdk are you using?

tonyjhuang avatar Sep 20 '22 18:09 tonyjhuang

I use the flutter SDK https://github.com/firebase/flutterfire/tree/master/packages/firebase_storage

Wizzel1 avatar Sep 20 '22 20:09 Wizzel1

I have a similar issue with 11.8.1 when using uploadBytesResumable with Node client. Only happens with PNGs.

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

When checking the type, it says application/octet-stream

balazss avatar Oct 15 '22 00:10 balazss

I also have a similar issue with any file that is larger than ~200kB: FirebaseError: Firebase Storage: An unknown error occurred, please check the error payload for server response. (storage/unknown) The type is always application/octet-stream and the size is always 262.14 kB

sebschre avatar Oct 19 '22 08:10 sebschre

We have the same issue when we do upload() via firebase admin to the storage emulator, since updating from 11.9.0 to 11.16.0

LanderBeeuwsaert avatar Nov 02 '22 10:11 LanderBeeuwsaert

I've been having a similar issue as well in the emulator: when adding a file to the emulator through firebase admin's upload() the type is always application/octet-stream.

rulamon avatar Nov 02 '22 16:11 rulamon

Hi, I think the discussion here has been for two separate issues.

  1. Some of you are having issues with resumable uploads erroring out and also having the type application/octet-stream (@sebschre, @balazss, and maybe @Wizzel1). I think this was reported before (https://github.com/firebase/firebase-tools/issues/4959) and fixed in this pr (https://github.com/firebase/firebase-tools/pull/5018). Try updating to the latest firebase-tools release and your issue should hopefully be fixed, if not please report back and we can take a closer look!
  2. There is another issue that I was able to reproduce where some admin sdks are not setting the file type properly, its always being set to application/octet-stream. The fix for this is a WIP.

@LanderBeeuwsaert and @rulamon I think you are running into this second issue. Which admin sdk are you using?

Yuangwang avatar Nov 07 '22 23:11 Yuangwang

Hi @Yuangwang, I'm running 11.2.0

LanderBeeuwsaert avatar Nov 07 '22 23:11 LanderBeeuwsaert

@LanderBeeuwsaert Sorry I think I was a bit unclear, which one of these from https://firebase.google.com/docs/admin/setup#prerequisites are you using?image

Yuangwang avatar Nov 07 '22 23:11 Yuangwang

@Yuangwang ah apologies, the Node.js SDK, package firebase-admin, 11.2.0

LanderBeeuwsaert avatar Nov 07 '22 23:11 LanderBeeuwsaert

Thanks! this will help in debugging

Yuangwang avatar Nov 07 '22 23:11 Yuangwang

Merged in fix for admin sdk issue https://github.com/firebase/firebase-tools/pull/5229 it should be out with the new release. I also followed the steps to reproduce the original bug and it seems to be fixed so I'm closing this for now.

Yuangwang avatar Nov 10 '22 21:11 Yuangwang