-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[🐛] Authentication not properly set on V2 Callable Cloud Function #6622
Comments
🤔 I was not aware there was anything special we needed to do to support v2 cloud functions. I think v2 cloud functions are more about how you deploy them using the firebase CLI ? https://firebase.google.com/docs/functions/beta https://firebase.google.com/docs/functions/beta/get-started#import_the_firebase-functions_sdk All I see with regard to v2 functions are things in the Node SDK / Admin SDK / CLI etc, I do not see any changes to the client SDKs, and here we only handle things in the client SDKs. When I look in the client SDKs I see no functions v2 activity: Implying, to me, that there is nothing to do here, but you may work to do outside the react-native-firebase area, where you develop+deploy functions code to access v2 APIs / types. Does that seem on target or am I missing something obvious + important? |
I guess the main thing I would add is this is happening when using the emulator so I don't think deploying really plays a role at this point. And to my knowledge, my version for the emulators supports emulated v2 functions. |
@atanaskanchev I saw that issue, but I wasn't really sure how to make heads or tails of it. Are you implying a fix is on that thread that I'm not quite understanding, or that it's a related issue? |
There is not (yet) a resolution on that one - the problem there is related to the URLs that the v2 functions are deployed on in the cloud, they are currently (during v2 functions public preview) on different URLs: https://firebase.google.com/docs/functions/beta/callable#write_and_deploy_the_callable_function (3rd paragraph or so)
which requires use of an API that we don't have here yet, to put that URL in: https://firebase.google.com/docs/functions/beta/callable#call_the_function That is, But this all begs the question: what's with the edit, the functions we need to wrap here are:
|
I've implemented getCallableFromUrl and I think that will help move this along. Merging that PR will close this, but if it's still not working afterward we can always reopen |
Just to confirm, to call http onCall v2 functions, we are supposed to pass the full function endpoint to the Here is an example v2 endpoint for reference: https://function-v2slug-uc.a.run.app edit: apologies, when I was reading through the changelog I assumed |
It is used like this - with full URL to the function endpoint: react-native-firebase/packages/functions/e2e/functions.e2e.js Lines 103 to 117 in 4592733
|
Anyone knows if this was resolved in the latest version? |
@nechmads Im also facing the same issue, request.auth is undefined in v2 onCall. |
@TrustyTechSG It's undefined for me too. // Message text passed from the client.
const text = request.data.text;
// Authentication / user information is automatically added to the request.
const uid = request.auth.uid;
const name = request.auth.token.name || null;
const picture = request.auth.token.picture || null;
const email = request.auth.token.email || null; Did you find a solution? |
Have you tried updating to the latest package and invoking the function with the
I have had no auth issues with v2 functions using the above syntax. |
Hi @julienreszka, we didn't find a good solution beside @trevor-rex's solution above(thank you @trevor-rex) which require a client side update, but this solution is more feeling like a workaround than a official support for v2 function. So we decide to leave it for now (as we didn't notice any noticeable improvement upgrade from v1 to v2) |
Issue
Apologies, if it's stated somewhere that V2 cloud functions are not yet supported in RNFirebase, but if they are I am having difficulty setting the auth param when calling a callable cloud function. According to the type definition, V2 functions should have an .auth property on the call request object that should have the uid and token. Everything else about the request is being correctly set, but not the auth property.
Please let me know though if V2 functions just aren't supported yet. And if so is there a timeline for it?
Project Files
Javascript
Click To Expand
package.json
:firebase.json
for react-native-firebase v6:iOS
Click To Expand
ios/Podfile
:AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:Firebase
module(s) you're using that has the issue:TypeScript
?React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: