-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
Cloud Functions
Which platforms are affected?
Android
Description
When calling HttpsCallable.stream multiple times in parallel for the same Cloud Function (e.g., 'generateSpeech'), the data streams collide. This results in "cross-talk" where one listener receives data chunks intended for a different call.
The issue lies in the MethodChannelHttpsCallable implementation. The EventChannel ID is currently hardcoded to the function's name:
_eventChannelId = name ?? _transformedUri ?? '';
_channel = EventChannel('plugins.flutter.io/firebase_functions/$_eventChannelId');Because the _eventChannelId is identical for every call to the same function name, all active listeners subscribe to the same broadcast channel on the platform side. The _eventChannelId must be made unique for every instance of MethodChannelHttpsCallable.
Reproducing the issue
Steps to Reproduce
- Create a Cloud Function that streams data.
- Trigger two separate calls to that function simultaneously using .stream().
- Observe that Stream A receives data intended for Stream B.
I can not provide an example due to time limitation.
Firebase Core version
4.2.1
Flutter Version
3.35.1
Relevant Log Output
Flutter dependencies
No response
Additional context and comments
No response