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

[Bug] Firebase Functions - GetHttpsCallable actually sends a POST request, should be renamed #1233

Open
Vixxd opened this issue Feb 18, 2022 · 2 comments

Comments

@Vixxd
Copy link

Vixxd commented Feb 18, 2022

[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)
image

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

@paulinon
Copy link
Contributor

Hi @Vixxd,

Thanks for filing this ticket. I've taken note of this and marked this as a feature request. You may refer to this thread for any updates.

@Vixxd
Copy link
Author

Vixxd commented Mar 1, 2022

Hi @Vixxd,

Thanks for filing this ticket. I've taken note of this and marked this as a feature request. You may refer to this thread for any updates.

That's great, thank you!

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

3 participants