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.72k stars 3.97k forks source link

Underlying error: The operation couldn’t be completed. The server responded with an error: #9036

Closed gmalmeida closed 2 years ago

gmalmeida commented 2 years ago

Bug report

Describe the bug A clear and concise description of what the bug is.

Steps to reproduce

Steps to reproduce the behavior:

  1. Check everything is fine with the flutter doctor -vcommand
    
    $ flutter doctor -v           
    [✓] Flutter (Channel stable, 3.0.4, on macOS 12.4 21F79 darwin-x64, locale en-DE)
    • Flutter version 3.0.4 at /usr/local/Caskroom/flutter/1.22.6/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 85684f9300 (5 days ago), 2022-06-30 13:22:47 -0700
    • Engine revision 6ba2af10bb
    • Dart version 2.17.5
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2) • Android SDK at /Users/gabriel/Library/Android/sdk • Platform android-33, build-tools 33.0.0-rc2 • ANDROID_HOME = /Users/gabriel/Library/Android/sdk • 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 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • 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)

[✓] IntelliJ IDEA Community Edition (version 2021.2.3) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin version 212.5632

[✓] VS Code (version 1.68.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.44.0

[✓] Connected device (4 available) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator) • iPhone de GABRIEL (mobile) • 078f58cccda2cf44b3a505bc1c89250983c45612 • ios • iOS 15.5 19F77 • macOS (desktop) • macos • darwin-x64 • macOS 12.4 21F79 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.53

[✓] HTTP Host Availability • All required HTTP hosts are available

• No issues found!


2. Run the app on the iPhone device connected over USB.3. 

$ flutter run -v -d 078f58cccda2cf44b3a505bc1c89250983c45612 . . . [ +139 ms] "status: ready to play" [ +573 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:64454/. [ +295 ms] flutter: Instance of 'InterstitialAd' loaded [ +681 ms] flutter: Instance of 'RewardedInterstitialAd' loaded. [ +68 ms] A valid SKAdNetworkIdentifier for Google (cstr6suwn9.skadnetwork) is missing from Info.plist. See [Enable SKAdNetwork to track conversions] (https://googlemobileadssdk.page.link/enable-skadnetwork) [ +48 ms] DDS is listening at http://127.0.0.1:64470/VWC3h3vChGk=/. [ +6 ms] 9.2.0 - [FirebaseFirestore][I-FST000001] AppCheck failed: 'The operation couldn’t be completed. Too many attempts. Underlying error: The operation couldn’t be completed. The server responded with an error: [ ] - URL: https://firebaseappcheck.googleapis.com/v1/projects/carpediem-d3916/apps/1:1051055649031:ios:ab86024b52bce8c3f2d5a 2:exchangeDeviceCheckToken [ ] - HTTP status code: 400 [ ] - Response body: { [ ] "error": { [ ] "code": 400, [ ] "message": "App not registered: 1:1051055649031:ios:ab86024b52bce8c3f2d5a2.", [ ] "status": "FAILED_PRECONDITION" [ ] } [ ] } [ ] ' [ ] 9.2.0 - [FirebaseFirestore][I-FST000001] AppCheck failed: 'The operation couldn’t be completed. Too many attempts. Underlying error: The operation couldn’t be completed. The server responded with an error: [ ] - URL: https://firebaseappcheck.googleapis.com/v1/projects/carpediem-d3916/apps/1:1051055649031:ios:ab86024b52bce8c3f2d5a 2:exchangeDeviceCheckToken [ ] - HTTP status code: 400 [ ] - Response body: { [ ] "error": { [ ] "code": 400, [ ] "message": "App not registered: 1:1051055649031:ios:ab86024b52bce8c3f2d5a2.", [ ] "status": "FAILED_PRECONDITION" [ ] } [ ] } [ ] ' [ +67 ms] Successfully connected to service protocol: http://127.0.0.1:64454/ [ +39 ms] DevFS: Creating new filesystem on the device (null) [ +66 ms] DevFS: Created new filesystem on the device (file:///private/var/mobile/Containers/Data/Application/0509AD9B-EDB0-48B2-B220-F30C7F6858D2/tmp/carpediemgXmBjg/c arpediem/) [ +2 ms] Updating assets [ +282 ms] Manifest contained wildcard assets. Inserting missing file into build graph to force rerun. for more information see #56466. [ +6 ms] Syncing files to device iPhone de GABRIEL...


4. See error or incorrect behavior

### Expected behavior

App runs on iPhone without a black screen.

### Flutter dependencies

Run `flutter pub deps -- --style=compact` and paste the output below:

<details><summary>Click To Expand</summary>

Dart SDK 2.17.5 Flutter SDK 3.0.4 carpediem 1.0.1+81

dependencies:

dev dependencies:

transitive dependencies:


ryzizub commented 2 years ago

Seems like that you have enabled AppCheck but wrongly configured on Firebase site. Do you have right p8 file and team id?

gmalmeida commented 2 years ago

Seems like that you have enabled AppCheck but wrongly configured on Firebase site. Do you have right p8 file and team id?

I do not have AppCheck enable (not that I am aware of). On Android, the application is running pretty well.

ryzizub commented 2 years ago

Seems like that you have enabled AppCheck but wrongly configured on Firebase site. Do you have right p8 file and team id?

I do not have AppCheck enable (not that I am aware of). On Android, the application is running pretty well.

Can you check your Firebase Console and App Check there if there is some enforcement?

darshankawar commented 2 years ago

@gmalmeida Looking at the error log you shared:


  +68 ms] <Google> <Google:HTML> A valid SKAdNetworkIdentifier for Google (cstr6suwn9.skadnetwork) is missing
from Info.plist. See [Enable SKAdNetwork to track conversions]

This seems to be related to ads mob library you might be using and need to check if you are using correct entry in info.plist file for it.


AppCheck failed: 'The operation couldn’t be completed. Too
many attempts. Underlying error: The operation couldn’t be completed. The server responded with an error:

https://firebaseappcheck.googleapis.com/v1/projects/carpediem-d3916/apps/1:1051055649031:ios:ab86024b52bce8c3f2d5a
2:exchangeDeviceCheckToken
[        ]  - HTTP status code: 400
[        ]  - Response body: {
[        ]   "error": {
[        ]     "code": 400,
[        ]     "message": "App not registered: 1:1051055649031:ios:ab86024b52bce8c3f2d5a2.",
[        ]     "status": "FAILED_PRECONDITION"
[        ]   }
[        ] }

For this, check https://stackoverflow.com/a/70966447 and see if it helps.

gmalmeida commented 2 years ago

Seems like that you have enabled AppCheck but wrongly configured on Firebase site. Do you have right p8 file and team id?

I do not have AppCheck enable (not that I am aware of). On Android, the application is running pretty well.

Can you check your Firebase Console and App Check there if there is some enforcement?

Thanks!

I have enabled it and was able to get rid of the error.

The issue now is: On Android) application runs out of the box (both on simulator and on device) On IOS) application shows a black screen (no ERROR reported / both on simulator and on device).

gmalmeida commented 2 years ago

@gmalmeida Looking at the error log you shared:


  +68 ms] <Google> <Google:HTML> A valid SKAdNetworkIdentifier for Google (cstr6suwn9.skadnetwork) is missing
from Info.plist. See [Enable SKAdNetwork to track conversions]

This seems to be related to ads mob library you might be using and need to check if you are using correct entry in info.plist file for it.


AppCheck failed: 'The operation couldn’t be completed. Too
many attempts. Underlying error: The operation couldn’t be completed. The server responded with an error:

https://firebaseappcheck.googleapis.com/v1/projects/carpediem-d3916/apps/1:1051055649031:ios:ab86024b52bce8c3f2d5a
2:exchangeDeviceCheckToken
[        ]  - HTTP status code: 400
[        ]  - Response body: {
[        ]   "error": {
[        ]     "code": 400,
[        ]     "message": "App not registered: 1:1051055649031:ios:ab86024b52bce8c3f2d5a2.",
[        ]     "status": "FAILED_PRECONDITION"
[        ]   }
[        ] }

For this, check https://stackoverflow.com/a/70966447 and see if it helps.

Yes, I had other .plist files for debugging and release, which were not updated.

Now the error got resolved, and the black screen issue remains :)

Thanks!