Description
[REQUIRED] Please fill in the following fields:
- Unity editor version: 2021.1.17f1
- Firebase Unity SDK version: 8.8.0
- Source you installed the SDK: .unitypackage
- Problematic Firebase Component: Functions
- Other Firebase Components in use: Auth, Firestore
- Additional SDKs you are using: N/A
- Platform you are using the Unity editor on: Windows
- Platform you are targeting: Android
- Scripting Runtime: IL2CPP
[REQUIRED] Please describe the issue here:
I am using Firebase Functions with Express routing set up, e.g. in my index.ts file (external to the Unity project):
api.get("/products", helloWorld);
When I call this route within my Unity project, using GetHttpsCallable in a C# file:
var func = _firebaseFunc.GetHttpsCallable("api/products");
It turns out a POST request is sent by default (using SmartSniff)
From reading about this (StackOverflow 1, 2) it seems this is intended behaviour - Firebase cloud functions indeed only accept POST requests: https://firebase.google.com/docs/functions/callable-reference
However, it would certainly solve a lot of headaches if the SDK method call did not begin with the word 'GET'. The only error message I was able to get was 'INTERNAL' in the Unity editor, or 'Not Valid JSON' when building to device, and as a result took some time to debug.
After creating a duplicate route with 'post' alongside my 'get' route, the call began to work as expected:
api.get("/products", helloWorld);
api.post("/products", helloWorld);
Steps to reproduce:
As above
Relevant Code:
As above