firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
215 stars 35 forks source link

[Bug] Function triggering error - Request has invalid method. GET #859

Closed aixaCode closed 1 year ago

aixaCode commented 1 year ago

[REQUIRED] Please fill in the following fields:

Unity editor version: 2022.3.6f1 Firebase Unity SDK version: 11.4.0 Source you installed the SDK: .unitypackage Problematic Firebase Component: Firestore Database Other Firebase Components in use: Auth, Crashlytics, Dynamic Links, Remote Config Additional SDKs you are using: Facebook Platform you are using the Unity editor on: Windows Platform you are targeting: iOS, Android Scripting Runtime:IL2CPP Pre-built SDK from the website or open-source from this repo: website

[REQUIRED] Please describe the issue here:

Occasionally, we encounter errors with some functions on certain Android devices. Although we have only soft-launched on Android, this issue might also be present on iOS. Below are the details and the necessary codes used in our setup:

Setup:

We use all our functions the same way.

Here is how we initiate a function call from the Unity side:

var function = functions.GetHttpsCallable(functionName);
logger.Log($"Firebase Function send start - {functionName}");
var response = await function.CallAsync(data);

Here is an example of a function from the Firebase side:

exports.createNewUser = FUNCTIONS.https.onCall(async (data, context) => {
  if (!context.auth) {
    console.error("The function must be called while authenticated.");
    return {
      error: "no-auth",
      serverTime: Date.now(),
    };
  }
  // Rest of the method body
  return {
    error: "ok",
    serverTime: Date.now(),
  };
});

At a relatively low frequency, these functions fail, generating the following logs: Request has invalid method. GET

Error: Invalid request, unable to process.
    at entryFromArgs (/workspace/node_modules/firebase-functions/lib/logger/index.js:130:19)
    at Object.error (/workspace/node_modules/firebase-functions/lib/logger/index.js:116:11)
    at /workspace/node_modules/firebase-functions/lib/common/providers/https.js:385:24
    at /workspace/node_modules/firebase-functions/lib/common/providers/https.js:374:25
    at cors (/workspace/node_modules/cors/lib/index.js:188:7)
    at /workspace/node_modules/cors/lib/index.js:224:17
    at originCallback (/workspace/node_modules/cors/lib/index.js:214:15)
    at /workspace/node_modules/cors/lib/index.js:219:13
    at optionsCallback (/workspace/node_modules/cors/lib/index.js:199:9)
    at corsMiddleware (/workspace/node_modules/cors/lib/index.js:204:7)

Steps to reproduce:

Currently, we have not been able to replicate this issue either locally or on any of our test devices. Here are example devices information that the issues occured

  1. Device 1 Brand: Oppo Model: RMX2020 OS Version: Android 10 CPU: ARM64 FP ASIMD AES GPU: Mali-G52 MC2

  2. Device 2 Brand: Samsung Model: Galaxy A53 5G OS Version: Android 13 CPU: ARM64 FP ASIMD AES GPU: Mali-G68

  3. Device 3 Brand: Transsion Model: Tecno OS Version: Android 12 CPU: ARM64 FP ASIMD AES GPU Device Name: PowerVR Rogue GE8300

The only common denominator noted across all occurrences is the CPU type.

What's the issue repro rate? 1/20

Let me know how I can provide any more information for you to troubleshoot that.

Relevant Code:

// TODO(you): code here to reproduce the problem
paulinon commented 1 year ago

Hi @aixaCode,

Given the information you provided and the frequency at which the error is occurring, it's likely that this is a backend issue. That said, I recommend that you raise this to Firebase Support where one of our agents can take a look at this. You can provide information related to your Firebase project in your support ticket.