Is there an existing issue for this?
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.
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
Is there an existing issue for this?
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:
Because the _eventChannelId is identical for every call to the same function name, all active listeners subscribe to the same broadcast channel.
Reproducing the issue
Steps to Reproduce
Firebase Core version
4.2.1
Flutter Version
3.35.1
Relevant Log Output
Flutter dependencies
No response
Additional context and comments
No response