firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.68k stars 3.97k forks source link

[cloud_functions] Firebase Error: (Internal) when calling function from flutter web #2558

Closed linhdogg closed 3 years ago

linhdogg commented 4 years ago

Describe the bug Im trying to call a cloud function which returns Auth User Data but getting an error "Internal". It does not show neither error code nor error details. To Reproduce Steps to reproduce the behavior:

  1. Create a function called getUserAuthData and deploy it successfully.
  2. Import cloud_functions package in package.yaml and add everything required in index.html.
  3. call a cloud function:
    try {
      final HttpsCallable callable = CloudFunctions.instance.getHttpsCallable(
          functionName: 'getUserAuthData')
        ..timeout = const Duration(seconds: 300);
      dynamic user = await callable.call();
      ...
    } on CloudFunctionsException catch (e) {
      print('caught firebase functions exception');
      print(e);
    } catch (e) {
      print('caught generic exception');
      print(e);
    }
    }

Expected behavior It supposes to return auth user data instead of caught generic exception (internal)

iapicca commented 4 years ago

Hi @linhdogg can you please provide your flutter doctor -v , your flutter run --verbose your pubspec.yaml, and a reproducible minimal code sample. Thank you

linhdogg commented 4 years ago

Hi @iapicca this is flutter doctor -v

Code Sample ``` [✓] Flutter (Channel dev, v1.18.0-10.0.pre, on Mac OS X 10.15.2 19C57, locale en-AU) • Flutter version 1.18.0-10.0.pre at /Users/alfred/Developer/flutter • Framework revision e0c63cd35e (4 weeks ago), 2020-04-23 22:29:01 -0400 • Engine revision d2ec21221e • Dart version 2.9.0 (build 2.9.0-3.0.dev b0d35855d8) [!] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/alfred/Library/Android/sdk • Platform android-29, build-tools 29.0.2 • ANDROID_HOME = /Users/alfred/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses [✓] Xcode - develop for iOS and macOS (Xcode 11.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.4.1, Build version 11E503a • CocoaPods version 1.8.4 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 44.0.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) [✓] VS Code (version 1.45.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.10.2 [✓] Connected device (2 available) • Web Server • web-server • web-javascript • Flutter Tools • Chrome • chrome • web-javascript • Google Chrome 81.0.4044.138 ! Doctor found issues in 1 category. ``` **flutter run --verbose:** ``` [ +7 ms] executing: [/Users/alfred/Developer/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H [ +31 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ ] e0c63cd35e15e407a80dc44281cc392535fcce25 [ ] executing: [/Users/alfred/Developer/flutter/] git tag --contains HEAD [ +137 ms] Exit code 0 from: git tag --contains HEAD [ +2 ms] 1.18.0-10.0.pre 1.18.0-11.0.pre 1.18.0-11.1.pre 1.18.0-12.0.pre 1.18.0-13.0.pre 1.18.0-8.0.pre 1.18.0-9.0.pre 1.19.0-0.0.pre 1.19.0-1.0.pre [ +10 ms] executing: [/Users/alfred/Developer/flutter/] git rev-parse --abbrev-ref --symbolic @{u} [ +8 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u} [ ] origin/dev [ ] executing: [/Users/alfred/Developer/flutter/] git ls-remote --get-url origin [ +7 ms] Exit code 0 from: git ls-remote --get-url origin [ ] git@github.com:flutter/flutter.git [ +45 ms] executing: [/Users/alfred/Developer/flutter/] git rev-parse --abbrev-ref HEAD [ +9 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ ] dev [ +5 ms] executing: sw_vers -productName [ +12 ms] Exit code 0 from: sw_vers -productName [ ] Mac OS X [ ] executing: sw_vers -productVersion [ +10 ms] Exit code 0 from: sw_vers -productVersion [ ] 10.15.2 [ ] executing: sw_vers -buildVersion [ +11 ms] Exit code 0 from: sw_vers -buildVersion [ +2 ms] 19C57 [ +37 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +8 ms] executing: /Users/alfred/Library/Android/sdk/platform-tools/adb devices -l [ +4 ms] executing: /usr/bin/xcode-select --print-path [ +5 ms] Exit code 0 from: /usr/bin/xcode-select --print-path [ ] /Applications/Xcode.app/Contents/Developer [ +1 ms] executing: /usr/bin/xcodebuild -version [ +74 ms] Exit code 0 from: /usr/bin/xcodebuild -version [ ] Xcode 11.4.1 Build version 11E503a [ +1 ms] executing: xcrun --find xcdevice [ +6 ms] Exit code 0 from: xcrun --find xcdevice [ ] /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice [ ] executing: xcrun xcdevice list --timeout 2 [ +3 ms] /usr/bin/xcrun simctl list --json devices [ ] executing: /usr/bin/xcrun simctl list --json devices [ +31 ms] List of devices attached [ +52 ms] { "devices" : { "com.apple.CoreSimulator.SimRuntime.tvOS-13-4" : [ { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/0AD1B0AA-32F0-40E1-812B-7676AA5BDA95\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/0AD1B0AA-32F0-40E1-812B-7676AA5BDA95", "udid" : "0AD1B0AA-32F0-40E1-812B-7676AA5BDA95", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p", "state" : "Shutdown", "name" : "Apple TV" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/6D288427-6BB7-4A45-9698-6A1E8A94575C\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/6D288427-6BB7-4A45-9698-6A1E8A94575C", "udid" : "6D288427-6BB7-4A45-9698-6A1E8A94575C", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.Apple-TV-4K-4K", "state" : "Shutdown", "name" : "Apple TV 4K" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/C8956A06-3060-4503-AC8B-045D52AEB58B\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/C8956A06-3060-4503-AC8B-045D52AEB58B", "udid" : "C8956A06-3060-4503-AC8B-045D52AEB58B", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.Apple-TV-4K-1080p", "state" : "Shutdown", "name" : "Apple TV 4K (at 1080p)" } ], "com.apple.CoreSimulator.SimRuntime.watchOS-6-2" : [ { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/009A0592-4A67-4D8D-BF06-8E51CBFEB335\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/009A0592-4A67-4D8D-BF06-8E51CBFEB335", "udid" : "009A0592-4A67-4D8D-BF06-8E51CBFEB335", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-4-40mm", "state" : "Shutdown", "name" : "Apple Watch Series 4 - 40mm" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/37AC558E-8213-442A-BAB6-6B5BBB1885DA\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/37AC558E-8213-442A-BAB6-6B5BBB1885DA", "udid" : "37AC558E-8213-442A-BAB6-6B5BBB1885DA", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-4-44mm", "state" : "Shutdown", "name" : "Apple Watch Series 4 - 44mm" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/3FEFD8B1-8BA5-4779-BC7F-5437BBD74D08\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/3FEFD8B1-8BA5-4779-BC7F-5437BBD74D08", "udid" : "3FEFD8B1-8BA5-4779-BC7F-5437BBD74D08", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-5-40mm", "state" : "Shutdown", "name" : "Apple Watch Series 5 - 40mm" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/B6CD7724-E00F-493E-8D72-273DEE7301B7\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/B6CD7724-E00F-493E-8D72-273DEE7301B7", "udid" : "B6CD7724-E00F-493E-8D72-273DEE7301B7", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.Apple-Watch-Series-5-44mm", "state" : "Shutdown", "name" : "Apple Watch Series 5 - 44mm" } ], "com.apple.CoreSimulator.SimRuntime.iOS-13-4" : [ { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/E3933D77-8A31-4CB5-ACC6-A6E6DDF62E65\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/E3933D77-8A31-4CB5-ACC6-A6E6DDF62E65", "udid" : "E3933D77-8A31-4CB5-ACC6-A6E6DDF62E65", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-8", "state" : "Shutdown", "name" : "iPhone 8" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/0D67F9EF-74D4-4612-9870-79B96EF18129\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/0D67F9EF-74D4-4612-9870-79B96EF18129", "udid" : "0D67F9EF-74D4-4612-9870-79B96EF18129", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus", "state" : "Shutdown", "name" : "iPhone 8 Plus" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/AC752599-EF65-43D7-BBF7-9CEDDEF6973D\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/AC752599-EF65-43D7-BBF7-9CEDDEF6973D", "udid" : "AC752599-EF65-43D7-BBF7-9CEDDEF6973D", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-11", "state" : "Shutdown", "name" : "iPhone 11" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/22B5914B-0C98-4FC0-9500-44903461EF92\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/22B5914B-0C98-4FC0-9500-44903461EF92", "udid" : "22B5914B-0C98-4FC0-9500-44903461EF92", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro", "state" : "Shutdown", "name" : "iPhone 11 Pro" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/D3440940-A121-429B-8CA9-CFA71DE0773B\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/D3440940-A121-429B-8CA9-CFA71DE0773B", "udid" : "D3440940-A121-429B-8CA9-CFA71DE0773B", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro-Max", "state" : "Shutdown", "name" : "iPhone 11 Pro Max" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/60AD6742-6F89-4AAA-A255-BF86D20555D4\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/60AD6742-6F89-4AAA-A255-BF86D20555D4", "udid" : "60AD6742-6F89-4AAA-A255-BF86D20555D4", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPhone-SE--2nd-generation-", "state" : "Shutdown", "name" : "iPhone SE (2nd generation)" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/52C03E44-4155-4B1D-9A0C-77C9AFFF38A0\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/52C03E44-4155-4B1D-9A0C-77C9AFFF38A0", "udid" : "52C03E44-4155-4B1D-9A0C-77C9AFFF38A0", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--9-7-inch-", "state" : "Shutdown", "name" : "iPad Pro (9.7-inch)" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/B17F04D4-0B78-4035-A9C4-959F5D2AC4E8\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/B17F04D4-0B78-4035-A9C4-959F5D2AC4E8", "udid" : "B17F04D4-0B78-4035-A9C4-959F5D2AC4E8", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPad--7th-generation-", "state" : "Shutdown", "name" : "iPad (7th generation)" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/5F6668D6-0080-49B9-B86F-7DC08EDF6502\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/5F6668D6-0080-49B9-B86F-7DC08EDF6502", "udid" : "5F6668D6-0080-49B9-B86F-7DC08EDF6502", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--11-inch---2nd-generation-", "state" : "Shutdown", "name" : "iPad Pro (11-inch) (2nd generation)" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/E9ABC5F7-3FE3-4F95-9C97-EA117DD994CD\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/E9ABC5F7-3FE3-4F95-9C97-EA117DD994CD", "udid" : "E9ABC5F7-3FE3-4F95-9C97-EA117DD994CD", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPad-Pro--12-9-inch---4th-generation-", "state" : "Shutdown", "name" : "iPad Pro (12.9-inch) (4th generation)" }, { "dataPath" : "\/Users\/alfred\/Library\/Developer\/CoreSimulator\/Devices\/F098CAB5-E8D8-4511-9660-D4A478C34560\/data", "logPath" : "\/Users\/alfred\/Library\/Logs\/CoreSimulator\/F098CAB5-E8D8-4511-9660-D4A478C34560", "udid" : "F098CAB5-E8D8-4511-9660-D4A478C34560", "isAvailable" : true, "deviceTypeIdentifier" : "com.apple.CoreSimulator.SimDeviceType.iPad-Air--3rd-generation-", "state" : "Shutdown", "name" : "iPad Air (3rd generation)" } ] } } [+2361 ms] [ { "simulator" : true, "operatingSystemVersion" : "13.4 (17L255)", "available" : true, "platform" : "com.apple.platform.appletvsimulator", "modelCode" : "AppleTV6,2", "identifier" : "6D288427-6BB7-4A45-9698-6A1E8A94575C", "architecture" : "x86_64", "modelUTI" : "com.apple.apple-tv-4k", "modelName" : "Apple TV 4K", "name" : "Apple TV 4K" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPad11,3", "identifier" : "F098CAB5-E8D8-4511-9660-D4A478C34560", "architecture" : "x86_64", "modelUTI" : "com.apple.ipad-air3-wifi-1", "modelName" : "iPad Air (3rd generation)", "name" : "iPad Air (3rd generation)" }, { "simulator" : true, "operatingSystemVersion" : "13.4 (17L255)", "available" : true, "platform" : "com.apple.platform.appletvsimulator", "modelCode" : "AppleTV5,3", "identifier" : "0AD1B0AA-32F0-40E1-812B-7676AA5BDA95", "architecture" : "x86_64", "modelUTI" : "com.apple.apple-tv-4", "modelName" : "Apple TV", "name" : "Apple TV" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPad8,12", "identifier" : "E9ABC5F7-3FE3-4F95-9C97-EA117DD994CD", "architecture" : "x86_64", "modelUTI" : "com.apple.ipad-pro-12point9-4th-1", "modelName" : "iPad Pro (12.9-inch) (4th generation)", "name" : "iPad Pro (12.9-inch) (4th generation)" }, { "simulator" : true, "operatingSystemVersion" : "6.2 (17T256)", "available" : true, "platform" : "com.apple.platform.watchsimulator", "modelCode" : "Watch5,4", "identifier" : "B6CD7724-E00F-493E-8D72-273DEE7301B7", "architecture" : "i386", "modelUTI" : "com.apple.watch-series5-1", "modelName" : "Apple Watch Series 5 - 44mm", "name" : "Apple Watch Series 5 - 44mm" }, { "simulator" : true, "operatingSystemVersion" : "6.2 (17T256)", "available" : true, "platform" : "com.apple.platform.watchsimulator", "modelCode" : "Watch5,3", "identifier" : "3FEFD8B1-8BA5-4779-BC7F-5437BBD74D08", "architecture" : "i386", "modelUTI" : "com.apple.watch-series5-1", "modelName" : "Apple Watch Series 5 - 40mm", "name" : "Apple Watch Series 5 - 40mm" }, { "simulator" : true, "operatingSystemVersion" : "13.4 (17L255)", "available" : true, "platform" : "com.apple.platform.appletvsimulator", "modelCode" : "AppleTV6,2", "identifier" : "C8956A06-3060-4503-AC8B-045D52AEB58B", "architecture" : "x86_64", "modelUTI" : "com.apple.apple-tv-4k", "modelName" : "Apple TV 4K (at 1080p)", "name" : "Apple TV 4K (at 1080p)" }, { "simulator" : true, "operatingSystemVersion" : "6.2 (17T256)", "available" : true, "platform" : "com.apple.platform.watchsimulator", "modelCode" : "Watch4,3", "identifier" : "009A0592-4A67-4D8D-BF06-8E51CBFEB335", "architecture" : "i386", "modelUTI" : "com.apple.watch-series4-1", "modelName" : "Apple Watch Series 4 - 40mm", "name" : "Apple Watch Series 4 - 40mm" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPad8,9", "identifier" : "5F6668D6-0080-49B9-B86F-7DC08EDF6502", "architecture" : "x86_64", "modelUTI" : "com.apple.ipad-pro-11-2nd-1", "modelName" : "iPad Pro (11-inch) (2nd generation)", "name" : "iPad Pro (11-inch) (2nd generation)" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPad6,4", "identifier" : "52C03E44-4155-4B1D-9A0C-77C9AFFF38A0", "architecture" : "x86_64", "modelUTI" : "com.apple.ipad-pro-9point7-a1674-b9b7ba", "modelName" : "iPad Pro (9.7-inch)", "name" : "iPad Pro (9.7-inch)" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone10,4", "identifier" : "E3933D77-8A31-4CB5-ACC6-A6E6DDF62E65", "architecture" : "x86_64", "modelUTI" : "com.apple.iphone-8-2", "modelName" : "iPhone 8", "name" : "iPhone 8" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone12,5", "identifier" : "D3440940-A121-429B-8CA9-CFA71DE0773B", "architecture" : "x86_64", "modelUTI" : "com.apple.iphone-11-pro-max-1", "modelName" : "iPhone 11 Pro Max", "name" : "iPhone 11 Pro Max" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone12,3", "identifier" : "22B5914B-0C98-4FC0-9500-44903461EF92", "architecture" : "x86_64", "modelUTI" : "com.apple.iphone-11-pro-1", "modelName" : "iPhone 11 Pro", "name" : "iPhone 11 Pro" }, { "simulator" : true, "operatingSystemVersion" : "6.2 (17T256)", "available" : true, "platform" : "com.apple.platform.watchsimulator", "modelCode" : "Watch4,4", "identifier" : "37AC558E-8213-442A-BAB6-6B5BBB1885DA", "architecture" : "i386", "modelUTI" : "com.apple.watch-series4-1", "modelName" : "Apple Watch Series 4 - 44mm", "name" : "Apple Watch Series 4 - 44mm" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone12,8", "identifier" : "60AD6742-6F89-4AAA-A255-BF86D20555D4", "architecture" : "x86_64", "modelUTI" : "com.apple.iphone-se-1", "modelName" : "iPhone SE (2nd generation)", "name" : "iPhone SE (2nd generation)" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPad7,12", "identifier" : "B17F04D4-0B78-4035-A9C4-959F5D2AC4E8", "architecture" : "x86_64", "modelUTI" : "com.apple.ipad-7-wwan-1", "modelName" : "iPad (7th generation)", "name" : "iPad (7th generation)" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone10,5", "identifier" : "0D67F9EF-74D4-4612-9870-79B96EF18129", "architecture" : "x86_64", "modelUTI" : "com.apple.iphone-8-plus-2", "modelName" : "iPhone 8 Plus", "name" : "iPhone 8 Plus" }, { "simulator" : true, "operatingSystemVersion" : "13.4.1 (17E8260)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone12,1", "identifier" : "AC752599-EF65-43D7-BBF7-9CEDDEF6973D", "architecture" : "x86_64", "modelUTI" : "com.apple.iphone-11-1", "modelName" : "iPhone 11", "name" : "iPhone 11" } ] [ +5 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +48 ms] More than one device connected; please specify a device with the '-d ' flag, or use '-d all' to act on all devices. [ +37 ms] Web Server • web-server • web-javascript • Flutter Tools [ ] Chrome • chrome • web-javascript • Google Chrome 81.0.4044.138 [ +9 ms] "flutter run" took 2,671ms. ``` **flutter run --verbose ERROR** ``` #0 throwToolExit (package:flutter_tools/src/base/common.dart:14:3) #1 RunCommand.validateCommand (package:flutter_tools/src/commands/run.dart:334:7) #2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:740:11) #3 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:657:33) #4 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart) #5 AppContext.run. (package:flutter_tools/src/base/context.dart:150:29) #6 _rootRun (dart:async/zone.dart:1184:13) #7 _CustomZone.run (dart:async/zone.dart:1077:19) #8 _runZoned (dart:async/zone.dart:1619:10) #9 runZoned (dart:async/zone.dart:1539:10) #10 AppContext.run (package:flutter_tools/src/base/context.dart:149:18) #11 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:647:20) #12 CommandRunner.runCommand (package:args/command_runner.dart:197:27) #13 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:339:21) #14 _rootRunUnary (dart:async/zone.dart:1192:38) #15 _CustomZone.runUnary (dart:async/zone.dart:1085:19) #16 _FutureListener.handleValue (dart:async/future_impl.dart:141:18) #17 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45) #18 Future._propagateToListeners (dart:async/future_impl.dart:711:32) #19 Future._completeWithValue (dart:async/future_impl.dart:526:5) #20 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:36:15) #21 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:303:13) #22 FlutterVersion.checkFlutterVersionFreshness (package:flutter_tools/src/version.dart) #23 _rootRunUnary (dart:async/zone.dart:1192:38) #24 _CustomZone.runUnary (dart:async/zone.dart:1085:19) #25 _FutureListener.handleValue (dart:async/future_impl.dart:141:18) #26 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45) #27 Future._propagateToListeners (dart:async/future_impl.dart:711:32) #28 Future._completeWithValue (dart:async/future_impl.dart:526:5) #29 Future._asyncComplete. (dart:async/future_impl.dart:556:7) #30 _rootRun (dart:async/zone.dart:1184:13) #31 _CustomZone.run (dart:async/zone.dart:1077:19) #32 _CustomZone.runGuarded (dart:async/zone.dart:979:7) #33 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1019:23) #34 _microtaskLoop (dart:async/schedule_microtask.dart:43:21) #35 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5) #36 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13) #37 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5) ```

pubspec.yaml

version: 1.0.0+1

environment:
  sdk: ">=2.6.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  dartz: ^0.9.0-dev.6
  freezed_annotation: ^0.7.1
  uuid: ^2.0.4
  flutter_bloc: ^3.2.0
  auto_route: ^0.4.4
  get_it: ^3.1.0
  meta: ^1.1.8
  algolia: ^0.1.7
  google_maps: ^3.4.1
  firebase_core: 0.4.4
  firebase_auth: 0.15.3
  google_sign_in: ^4.1.1
  cloud_firestore: ^0.13.5
  cloud_functions: ^0.5.0
  cloud_functions_web: ^1.1.0
  injectable: ^0.3.0
  flushbar: ^1.10.0
  intl: ^0.16.1
  timeago: ^2.0.26
  json_annotation: ^3.0.1
  google_maps_flutter: ^0.5.27
  google_maps_flutter_platform_interface: ^1.0.1
  styled_widget: ^0.1.1
  flutter_hooks: ^0.8.0
  time: ^1.2.0
  kt_dart: ^0.7.0
  rxdart: ^0.23.1
  dash_chat: ^1.1.1
  reorderables: ^0.2.12
  responsive_builder: ^0.1.2
  provider: ^4.0.4
  carousel_slider: ^2.0.0
  smooth_star_rating: 1.0.4+2
  implicitly_animated_reorderable_list: ^0.1.9
  flutter_slidable: ^0.5.4

dev_dependencies:
  flutter_test:
    sdk: flutter
  mockito: ^4.1.1
  cloud_firestore_mocks: ^0.4.2
  lint: ^1.1.1
  build_runner:
  freezed: ^0.9.2
  auto_route_generator: ^0.4.5
  injectable_generator: ^0.3.2
  json_serializable: ^3.2.5
jans-y commented 4 years ago

Looks like it may be related to https://github.com/FirebaseExtended/flutterfire/pull/2706 and https://github.com/FirebaseExtended/flutterfire/pull/2556

GyuriMajercsik commented 4 years ago

Make sure you have the right version in index.html (per https://pub.dev/packages/cloud_functions_web) :

<script src="https://www.gstatic.com/firebasejs/7.6.2/firebase-functions.js"></script>

instead of

<script src="https://www.gstatic.com/firebasejs/7.21.1/firebase-functions.js"></script>

I upgraded all of my firebase js dependencies and cloud functions stopped working after that. Had no clue that this was the issue.

jimmyff commented 4 years ago

I'm also getting this FirebaseError: internal (internal)

Stack trace ``` 46:45 ReduxLogging/INFO: {Action: Instance of 'MakeAdminAction', State: StoreState, ts: 2020-10-06 15:56:46.045} Error: FirebaseError: internal (internal) at Object.throw_ [as throw] (http://localhost:7357/dart_sdk.js:4328:11) at handleThenable (http://localhost:7357/packages/firebase/src/storage.dart.lib.js:3264:21) at handleThenable.throw () at http://localhost:7357/dart_sdk.js:37599:38 at _RootZone.runBinary (http://localhost:7357/dart_sdk.js:37452:58) at _FutureListener.thenAwait.handleError (http://localhost:7357/dart_sdk.js:32436:48) at handleError (http://localhost:7357/dart_sdk.js:32987:51) at Function._propagateToListeners (http://localhost:7357/dart_sdk.js:33013:17) at _Future.new.[_completeError] (http://localhost:7357/dart_sdk.js:32860:23) at async._AsyncCallbackEntry.new.callback (http://localhost:7357/dart_sdk.js:32898:31) at Object._microtaskLoop (http://localhost:7357/dart_sdk.js:37708:13) at _startMicrotaskLoop (http://localhost:7357/dart_sdk.js:37714:13) at http://localhost:7357/dart_sdk.js:33226:9 ```

I've adjusted my firebase-functions.js import to 7.6.2 however I am still getting the error.

zenkog commented 3 years ago

Any solution to this? I got the same error.

tapizquent commented 3 years ago

Is there any news or workarounds for this yet?

alexandru-g commented 3 years ago

I tried rolling back everything to an older version (0.8.0 cloud_functions and compatible rest of libraries) and it still doesn't work. Even the most simple form of cloud functions trigger this internal exception.

GyuriMajercsik commented 3 years ago

I tried rolling back everything to an older version (0.8.0 cloud_functions and compatible rest of libraries) and it still doesn't work. Even the most simple form of cloud functions trigger this internal exception.

Do you have the right version in index.html ? image

alexandru-g commented 3 years ago

I tried rolling back everything to an older version (0.8.0 cloud_functions and compatible rest of libraries) and it still doesn't work. Even the most simple form of cloud functions trigger this internal exception.

Do you have the right version in index.html ? image

Yes, same issue. Internal error. This happens with both local emulator and deployed functions. The thing is that the functions are executed successfully (I can see it in the logs). It's just that the flutter functions library throws this exception afterwards.

alexandru-g commented 3 years ago

@GyuriMajercsik I found the issue, but with my limited web skills I have no idea how to fix it: Access to fetch at 'http://localhost:5001/*******' from origin 'http://localhost:37349' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

alexandru-g commented 3 years ago

Ok, so if you're hitting the CORS issue, it seems that the function is getting triggered on the OPTIONS request the browser is making. You need to return the standard CORS response and then the browser will make the normal request using POST.

AresVampire commented 3 years ago

Seems 7.22.0 version is broken for cloud functions, but for 7.22.1, it is working.

vishnuagbly commented 3 years ago

It is not working for me on any version, I cannot believe it is still not fixed and it has been about a year now.

vishnuagbly commented 3 years ago

@markusaksli-nc, @linhdogg,@alexandru-g has anyone found any workaround for this? Or is there anyone working on this issue?

alexandru-g commented 3 years ago

@vishnuagbly as a temporary workaround, in your cloud functions, check first if it's an OPTIONS type of request and return 200. The normal POST will work correctly afterwards.

vishnuagbly commented 3 years ago

@alexandru-g since we are using firebase cloud functions our cloud function looks like this

const functions = require('firebase-functions');

exports.listFruit = functions.https.onCall((data, context) => {
  return ["Apple", "Banana", "Cherry", "Date", "Fig", "Grapes"]
});

I don't know how to do that here 😥

alexandru-g commented 3 years ago

@vishnuagbly you can also use onRequest instead of onCall. Please see the documentation: https://firebase.google.com/docs/functions/get-started#add-the-addmessage-function.

In the example above you can check the type of request in the req object. Also, please make sure you set the appropriate CORS headers. Something like:

export const someFunction = functions.https.onRequest((request, response) => {
    response.set({
        'Access-Control-Allow-Origin': '*',
        'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE,PATCH,OPTIONS',
        'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept, Authorization',
    });
    if (request.method == "OPTIONS") {
        response.sendStatus(200);
        return;
    }
    // Your normal function execution
}

I had no problem by doing the above, but it's just a workaround.

hallr-boulder commented 3 years ago

Stunning that this show stopping, critical bug hasn't been fixed. Sours me on the whole not-ready-for-prime-time Google cloud ecosystem. Disclosure: I submitted #5428 (now closed as a duplicate) after spending a week looking for a work-around. Did not find a work-around. No combination of cloud_functions and JS versions works for me.

vishnuagbly commented 3 years ago

@alexandru-g unfortunately I cannot use your workaround as I need the context object to check for firebase authorization and uid, and for which I don't have enough knowledge to implement it by myself using HTTP requests.

vishnuagbly commented 3 years ago

I fixed it, at least for me. 1) I used 7.14.2 version same as in the cloud functions package example. 2) I think we also need to make sure that firebase-app and firebase functions js files are of same version, as I changed both to 7.14.2 and it worked.

hallr-boulder commented 3 years ago

@vishnuagbly I'm still seeing the problem (that is, I'm still seeing the internal exception). Would you let me know more precisely the two locations where you sync'd up the js versions? Index.html in the app and ??

I'd like to make sure that I'm doing the same thing. Thanks in advance!

vishnuagbly commented 3 years ago

@hallr-boulder, This is my index.html file now, I changed just this

<!DOCTYPE html>
<html>
<head>
  <!--
    If you are serving your web app in a path other than the root, change the
    href value below to reflect the base path you are serving from.

    The path provided below has to start and end with a slash "/" in order for
    it to work correctly.

    Fore more details:
    * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
  -->
  <base href="/">

  <meta charset="UTF-8">
  <meta content="IE=Edge" http-equiv="X-UA-Compatible">
  <meta name="description" content="A new Flutter project.">

  <!-- iOS meta tags & icons -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="appName">
  <meta name="google-signin-client_id" content="<GOOGLE_SIGN_IN_API_KEY>">
  <link rel="apple-touch-icon" href="icons/Icon-192.png">

  <!-- Favicon -->
  <link rel="icon" type="image/png" href="favicon.png"/>

  <title>appName</title>
  <link rel="manifest" href="manifest.json">
</head>
<body>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.14.4/firebase-app.js"></script>

<script src="/__/firebase/8.3.1/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.4/firebase-functions.js"></script>

<!-- Initialize Firebase -->
<script>
      const firebaseConfig = {
           //copied from firbase console -> project_settings -> web_app -> config
      };

      // Initialize Firebase
      firebase.initializeApp(firebaseConfig);
    </script>
  <!-- This script installs service_worker.js to provide PWA functionality to
       application. For more information, see:
       https://developers.google.com/web/fundamentals/primers/service-workers -->
  <script>
    if ('serviceWorker' in navigator) {
      window.addEventListener('flutter-first-frame', function () {
        navigator.serviceWorker.register('flutter_service_worker.js');
      });
    }
  </script>
  <script src="main.dart.js" type="application/javascript"></script>
</body>
</html>

This was my commit:- Screenshot (3)

hallr-boulder commented 3 years ago

@vishnuagbly Thanks for the additional information! Still no luck however. Still getting the internal exception. Very puzzling.

vishnuagbly commented 3 years ago

I feel like flutter should provide more information than the internal exception.

dancamdev commented 3 years ago

This is broken for me too, can't get any onCall function to work, no matter if the flutter web app is on localhost or deployed to https, I always get a CORS policy error

<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-functions.js"></script>

These are the versions of firebase I have in my index.html

russellwheatley commented 3 years ago

Hey folks, I've just confirmed this works on web. Please ensure you're using the following scripts in your index.html file as per the documentation:

    <script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-app.js"></script>
    <script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-functions.js"></script>

along with the latest functions version as per documentation:

  firebase_core: "^1.0.4"
  cloud_functions: "^1.0.4"
hallr-boulder commented 3 years ago

@russellwheatley Still fails (internal exception) for me using JS 8.4.1 and latest versions of firebase_core & cloud_functions.

This bug seems to be dependent on something that we're missing/not seeing. Super hard to say without debugging the js:

@russellwheatley I don't think the bug should be closed just because the code works for you. Can you provide details of your configuration (Flutter doctor) so that I can see what might be different? Thanks!

bsz0206 commented 3 years ago

I also have the same issue but it works before user logs in to google. As soon as _firebaseAuth.signInWithCredential succeeds, all subsequent calls show FirebaseFunctionsException with 'internal' as the error. Anyone any idea?