Skip to content

[Bug] Unable to use the Firebase Resize Image Extension when uploading from the Unity SDK #1107

Closed
firebase/firebase-cpp-sdk
#911
@ChristianMcFarlaneWork

Description

@ChristianMcFarlaneWork

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2019.4.28f1
  • Firebase Unity SDK version: 7.2.0
  • Source you installed the SDK: .unitypackage
  • Problematic Firebase Component: Storage
  • Other Firebase Components in use: Auth, Database, Firestore, Resize Image Extension
  • Additional SDKs you are using: Yodo1, Megacool, Buncha stuff honestly
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: iOS, Android
  • Scripting Runtime: il2CPP

[REQUIRED] Please describe the issue here:

Cross Posting from another issue posted here as this one seems to be more active and actually referenced in the Release logs.

We're trying to use the resize Image Extension alongside the Firebase SDK to generate different sized version of thumbnails that we upload to Storage. However no matter how we upload our images to the server, the extension is never triggered because the image format seems to be incorrect.

We encounter these logs in the extension console

Function execution started 
---
Started execution of extension with configuration {"bucket":"(Our correct App Bucket URL)","deleteOriginalFile":1,"imageSizes":["128x128"],"imageTypes":["false"],"includePathList":["/CustomMaps/*/Previews"]}
--
File of type 'application/x-www-form-urlencoded' is not an image, no processing is required
--
Function execution took 7 ms, finished with status: 'ok'  

I've attached the code we are using to upload files below, which shows that we are also explicitly assigning the content type which as we understand should enforce this encoding. Even looking at the file on the dashboard, it does show that the metadata was set correctly, with our Content-Type showing up as 'image/png'.. But the extension still isn't triggered.

Steps to reproduce:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
What's the issue repro rate? (eg 100%, 1/5 etc)

99% Repro rate. Has only worked once in production. Using the same codebase as all the other non working images.

What happened? How can we make the problem occur?
We haven't attempted to repro on a smaller project. However, the steps we take to have this issue occur are as follows

  1. Install and setup the Resize Image extension inside of your storage bucket you will be uploading to.
  2. Generate an image at runtime using a camera, and writing the output to a Texture2D.
  3. Encode the Image as a PNG and cache the byte array.
  4. Create a new MetadataChange object and set the ContentType parameter to image/png.
  5. Put all bytes Async into the bucket and storage location governed by the Resize Image extension.
  6. Note that the Extension is not triggered.
  7. Note that the metadata for the uploaded image is correct, and is showing up as image/png
    ~ Code example has been attached at the bottom for reference of the steps to reproduce
    This could be a description, log/console output, etc.

Relevant Code:

Here's the relevant code that we use to upload our images to our server.

byte[] imageBytes = previewTexture.EncodeToPNG();
MetadataChange metadata = new MetadataChange() { ContentType = "image/png" };
bucket.Child("CustomMaps/UserId/Previews/MapID.png").PutBytesAsync(imageBytes, metadata);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions