flutterfire
flutterfire copied to clipboard
🐛 cloud functions, missing plugin exception for method Firebase Functions #call
Bug when calling a callable function when web app is deployed on firebase hosting.
When function is called locally it work fine in web app and native.
When deployed function is not called and error message appear:
MissingPluginExecption(no implementation found for method FirebaseFunction#call on channel plugins.flutter.io/firebase_functions)
Sample code:
final functions = FirebaseFunctions.instanceFor(region: 'europe-central2');
const checkInEventParticipant = "events-checkInEventParticipant";
class FbFunctions {
static Future<void> addUserIdToEvent(
{required String userId, required String eventId}) async {
try {
await functions
.httpsCallable(checkInEventParticipant)
.call({"userId": userId, "eventId": eventId});
} on FirebaseFunctionsException catch (error) {
debugPrint(
'Functions error code: ${error.code}, details: ${error.details}, message: ${error.message}');
rethrow;
}
}
}
cloud_functions: ^4.3.0 firebase_core: ^2.9.0
Flutter doctor:
[✓] Flutter (Channel stable, 3.7.11, on macOS 13.3.1 22E772610a darwin-arm64, locale pl-PL) • Flutter version 3.7.11 on channel stable at /Users/michalklepaczko/projekty_dev/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f72efea43c (4 weeks ago), 2023-04-11 11:57:21 -0700 • Engine revision 1a65d409c7 • Dart version 2.19.6 • DevTools version 2.20.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/michalklepaczko/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E222b • CocoaPods version 1.11.3
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.78.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.64.0
[✓] Connected device (3 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E772610a darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.92
[✓] HTTP Host Availability • All required HTTP hosts are available
• No issues found!
To my surprise it appears that it works when built with --web-renderer html ...
@mklepaczko Thanks for the report. Can you upgrade to latest firebase_core and try again to see if the issue persists or not ?
Hi, issue still persists with firebase_core: ^2.12.0
Thanks for the feedback. Keeping this issue open for team's input on reported behavior and potential solution.
+1 with the exact issue. I need to use the canvaskit
renderer.
Using the latest versions..
cloud_functions: ^4.3.2
firebase_core: ^2.13.1
usage..
final response = await FirebaseFunctions.instance.httpsCallable('chatCompletion').call(
request?.toJson(),
);
Works fine in local. Gives the following error when deployed to firebase hosting..
MissingPluginException(No implementation found for method FirebaseFunctions#call on channel plugins.flutter.io/firebase_functions)
@darshankawar
Switching to the beta channel (3.12.0) fixed the issue for me!
I have this same issue and I'm on the beta channel. It works fine locally, but it breaks in prod if I specify --web-renderer canvaskit
But what's really weird is that it works when I don't supply the canvaskit argument and just use the default, which is, in fact, canvaskit for desktop browsers and html for mobile browsers. And it works on both desktop browsers and mobile browsers if I don't specify canvaskit.
Is it possible that supplying the web-renderer argument somehow skips copying the configuration from index.html?
cloud_firestore: ^4.8.2
cloud_functions: ^4.4.2
firebase_auth: ^4.7.1
firebase_core: ^2.22.0
> flutter doctor -v
[✓] Flutter (Channel beta, 3.16.0-0.2.pre, on Ubuntu 20.04.6 LTS
5.15.0-86-generic, locale en_CA.UTF-8)
• Flutter version 3.16.0-0.2.pre on channel beta
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fe6553b689 (5 weeks ago), 2023-10-11 19:07:11
-0700
• Engine revision 249cc9b86c
• Dart version 3.2.0 (build 3.2.0-210.2.beta)
• DevTools version 2.28.1
[✓] Android toolchain - develop for Android devices (Android SDK version
33.0.1)
• Android SDK at /home/gj/Android/Sdk
• Platform android-33, build-tools 33.0.1
• Java binary at: /home/gj/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build
17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = /usr/bin/google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[✓] Android Studio (version 4.0)
• Android Studio at /opt/android-studio-4.0/android-studio
• Flutter plugin version 51.0.1
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
[✓] Android Studio (version 2022.3)
• Android Studio at /home/gj/android-studio
• Flutter plugin version 75.1.2
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• android-studio-dir = /home/gj/android-studio
• Java version OpenJDK Runtime Environment (build
17.0.6+0-17.0.6b829.9-10027231)
[!] Android Studio (version unknown)
• Android Studio at /opt/android-studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to determine Android Studio version.
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] VS Code (version 1.83.1)
• VS Code at /usr/share/code
• Flutter extension version 3.76.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.6 LTS
5.15.0-86-generic
• Chrome (web) • chrome • web-javascript • Google Chrome
118.0.5993.70
[✓] Network resources
• All expected network resources are available.
+1 same issue here. I'm using cloud_functions: ^4.6.0
Same here and the lottie package has an issue where you have to build with canvaskit but the workaround here was just use html https://github.com/xvrh/lottie-flutter/issues/174#issuecomment-972636769
Having the same issue as well, using cloud_functions: ^4.6.0. Doesn't work regardless of whether or not I specify html.
Switching to the beta channel (3.12.0) fixed the issue for me!
@csanz91 what plugin is this for?
I was able to fix it by doing flutter clean
, flutter upgrade
, and flutter pub upgrade
. Not sure which of those three did it.
Make sure to:
-> Add the script block below to your /{project name}/web
-> run Flutter clean
-> run Flutter pub upgrade
-> build & deploy
(I'm using html renderer by requirement so wouln't be able to tell if working with canvas kit plays a role in this issue but the steps above solved it for me)
<script>
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getAnalytics } from "firebase/analytics";
import { getFunctions } from "firebase/functions";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "your data",
authDomain: "your data",
databaseURL: "your data",
projectId: "your data",
storageBucket: "your data",
messagingSenderId: "your data",
appId: "your data",
measurementId: "your data"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
</script>
Cheers
Since a solution has been provided, and the issue seemed to be related to Flutter versions, I'm closing this issue. Feel free to reopen of it's still happening.
I have the same issue with window application. with dart 3.4.3 and fluter 3.22.2. all solutioned provided above didn't work.