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

🐛 [@react-native-firebase/functions] Missing stream implementation for httpsCallable functions #8210

Open
harveyappleton opened this issue Jan 4, 2025 · 8 comments
Labels
Needs Attention plugin: functions Firebase Cloud Functions type: enhancement Implements a new Feature

Comments

@harveyappleton
Copy link

harveyappleton commented Jan 4, 2025

Hey amazing invertase team! Happy new year!

In Dec 2024, a PR was merged into firebase-js-sdk that allows you to stream responses from Firebase functions which is awesome! I've tried it out on web and it works wonderfully. Would be awesome if this could be implemented in RN Firebase Functions!!! :D

@mikehardy
Copy link
Collaborator

Neat, wasn't aware of that work.

I believe we'll need underlying SDK support prior to us being able to do anything at this layer above them

iOS: firebase/firebase-ios-sdk#14290
Android: firebase/firebase-android-sdk#6602

After that we'll have a fair bit of work here to wrap them and present them in a manner compatible with firebase-js-sdk (or we'd happily accept a PR of course...)

The only thing I can think of in the meantime is that you can actually use the firebase-js-sdk alongside react-native-firebase if you like. It is bundled with react-native-firebase as it is used as a fallback for "other" platform support already internally here. You'll have to initialize an app manually after react-native-app boot just like you do on web, and if you use AppCheck you'll have to set the firebase-js-sdk functions headers with it after fetching it from react-native-firebase/app-check, similar with auth - but those headers shouldn't be too hard to set ?

@harveyappleton
Copy link
Author

harveyappleton commented Jan 5, 2025

I looked into using firebase-js-sdk alongside, but I think the issue is that on React Native, the fetch implementation doesn't support ReadStream. Seems like a common problem. However I found that Expo SDK 52 provides a fetch implementation that is winter cg compliant that supports streaming, so I'm currently updating my app to use that instead and will just manually stream from the firebase function I think :) I can get the Bearer token from firebase auth using getIdToken() so should be all good to go 🙏 would be awesome if the RN firebase supported it but I understand its probably a big chunk of work.

@mikehardy
Copy link
Collaborator

Is a big chunk of work to support it here but most importantly we can't do anything not provided by the underling native android and iOS SDKs, so we are necessarily blocked on them regardless.

Very nifty that it looks like it'll be possible to "weld together" the firebase-js-sdk library support for it while still using react-native-firebase for it's native-only stuff though

Copy link

github-actions bot commented Feb 2, 2025

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot added the Stale label Feb 2, 2025
@harveyappleton
Copy link
Author

Still requires attention

@mikehardy
Copy link
Collaborator

@harveyappleton there's nothing we can do here, I just paid attention to it but it unfortunately wasn't attention well spent.
Without upstream support there is nothing we can do, and it hasn't landed there as far as I know.

You might look at the VertexAI implementation that we'll be landing soon though - it was able to use react-native fetch plus some polyfills to get readable stream support using javascript. That strategy can work:

https://github.com/invertase/react-native-firebase/pull/8236/files#diff-f22d3ccf7d705193a63381ca0d16187ba37c273cfaa52cbaac399f237f3e9278

Copy link

github-actions bot commented Mar 8, 2025

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot added the Stale label Mar 8, 2025
@mikehardy
Copy link
Collaborator

Streaming callable functions appears to have landed in firebase-android-sdk (33.11.0) and firebase-ios-sdk (11.10.0) now, this should be possible to implement now

@mikehardy mikehardy added plugin: functions Firebase Cloud Functions and removed Stale labels Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention plugin: functions Firebase Cloud Functions type: enhancement Implements a new Feature
Projects
None yet
Development

No branches or pull requests

2 participants