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

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

Closed
Wizzel1 opened this issue Sep 15, 2022 · 13 comments

Comments

@Wizzel1
Copy link

Wizzel1 commented Sep 15, 2022

[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 Wizzel1 added the bug label Sep 15, 2022
@google-oss-bot
Copy link
Contributor

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

@tonyjhuang
Copy link
Contributor

what sdk are you using?

@fredzqm fredzqm assigned tonyjhuang and unassigned fredzqm Sep 20, 2022
@Wizzel1
Copy link
Author

Wizzel1 commented Sep 20, 2022

@balazss
Copy link

balazss commented Oct 15, 2022

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

@sebschre
Copy link

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

@LanderBeeuwsaert
Copy link

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

@rulamon
Copy link

rulamon commented Nov 2, 2022

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.

@Yuangwang
Copy link
Contributor

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 (Storage emulator: unknown error with resumable uploads #4959) and fixed in this pr (Fix firebase storage resumable uploads #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?

@LanderBeeuwsaert
Copy link

Hi @Yuangwang, I'm running 11.2.0

@Yuangwang
Copy link
Contributor

@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

@LanderBeeuwsaert
Copy link

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

@Yuangwang
Copy link
Contributor

Thanks! this will help in debugging

@Yuangwang
Copy link
Contributor

Merged in fix for admin sdk issue #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.

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