[Bug] Unable to use the Firebase Resize Image Extension when uploading from the Unity SDK - quickstart-unity

[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);
Asked Sep 27 '21 00:09
avatar ChristianMcFarlaneWork

3 Answer:

Hi @ChristianMcFarlaneWork,

Could you verify if this issue persists with the latest version of the SDK (8.1.0)? If so, please provide a minimal, reproducible example of your project along with the steps you've taken before facing the issue. This way, we can identify what's causing this behavior.

Answered Aug 09 '21 at 08:22
avatar  of paulinon

Hey @paulinon, We updated to Firebase 8.1.0 and the issue still persists. Though after the update and a hotfix we had a day or so where everything was working correctly. However the issue seems to have appeared again, so that's why this reply is so late. I've attached a repro which outlines the problem as requested. Details for setup are a part of the repositories readme. Let me know if you have any questions or issues, and I'll try to get back to you a little quicker this time. Cheers.

Answered Aug 13 '21 at 02:38
avatar  of ChristianMcFarlaneWork

Hi @ChristianMcFarlaneWork,

I was able to replicate your issue. However, it appears that the cause of this behavior is more related to the Extensions backend rather than the Storage SDK. You may raise this with Firebase Support.

With that, I'll be closing this ticket for now.

Answered Aug 13 '21 at 14:34
avatar  of paulinon