React-native-firebase: [proposal] firebase.functions()

Created on 3 Apr 2018  路  9Comments  路  Source: invertase/react-native-firebase

This issue is to discuss the newly released functions API, possible API implementation spec for RNFirebase and track interest.

Announcement: https://firebase.googleblog.com/2018/04/launching-cloud-functions-for-firebase-1-0.html?m=1

SDK Guide: https://firebase.google.com/docs/functions/callable?utm_source=blog&utm_medium=blog&utm_campaign=cloud_functions_v1.0

General Android JavaScript iOS Feature Request

Most helpful comment

@jeveloper we did briefly internally discuss the possibility of using fetch in JS (mainly curiosity) but we're actually going to stick with using the native SDK's rather than rolling our own when there's no need to.

Re the headers, you're correct, that is how it works pretty much - requires the authentication token and the instance id token (optionally) to work, see: https://github.com/firebase/firebase-js-sdk/blob/master/packages/functions/src/context.ts#L70

The web/js SDK implementation can be seen here: https://github.com/firebase/firebase-js-sdk/blob/master/packages/functions/src/api/service.ts

All 9 comments

This is a nice feature to utilize.
I thought it was already possible by just using Google Cloud Functions by heading Header with auth.

Curious if you're planning on implementing using native SDK (http client with java and swift/objective c) or just high level Fetch

@jeveloper we did briefly internally discuss the possibility of using fetch in JS (mainly curiosity) but we're actually going to stick with using the native SDK's rather than rolling our own when there's no need to.

Re the headers, you're correct, that is how it works pretty much - requires the authentication token and the instance id token (optionally) to work, see: https://github.com/firebase/firebase-js-sdk/blob/master/packages/functions/src/context.ts#L70

The web/js SDK implementation can be seen here: https://github.com/firebase/firebase-js-sdk/blob/master/packages/functions/src/api/service.ts

Thanks for using native code, should be more performant :)

@Salakar is it possible to have a hack-around to be able to call functions in rnfirebase until the support is added?

@asadighi if you want a hack-around, then it's something you'll have to implement yourself I'm afraid. We'll release a proper implementation in due course.

(PRs would also be considered on this - discuss here or on discord if you're picking it up)

All - have started implementing this on the functions branch: https://github.com/invertase/react-native-firebase/tree/functions

@jeveloper @asadighi and others, I have just submitted the PR for this 馃帀 https://github.com/invertase/react-native-firebase/pull/1056

Closing this issue. Hoping to land the PR as part of v4.1. Testers are welcome to try it our from master branch!

Was this page helpful?
0 / 5 - 0 ratings