invertase / flutterfire_cli

A CLI to help with using FlutterFire in your Flutter applications.
Apache License 2.0
164 stars 47 forks source link

[bug]: PhaseScriptExecution error on the iOS flavor with extra target+scheme+configuration within `firebase.json` #293

Open muknta opened 1 month ago

muknta commented 1 month ago

Is there an existing issue for this?

CLI Version

1.0.0

Firebase Tools version

13.0.2

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.19.5, on macOS 14.3.1 23D60 darwin-arm64, locale en-GB) • Flutter version 3.19.5 on channel stable at /Users/heknt/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 300451adae (6 weeks ago), 2024-03-27 21:54:07 -0500 • Engine revision e76c956498 • Dart version 3.3.3 • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at /Users/user/Library/Android/sdk • Platform android-34, build-tools 32.0.0 • ANDROID_HOME = /Users/user/Library/Android/sdk • ANDROID_SDK_ROOT = /Users/user/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C500b • CocoaPods version 1.15.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.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 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.88.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available) • iPhone 15 Pro (mobile) • E5311B6B-0257-41C7-B107-471670430AD5 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.3.1 23D60 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.69

[✓] Network resources • All expected network resources are available.

• No issues found!

Description

I try to run flutter with a FlutterFire build phase on a flavor with a different iOS target. There is an error:

        #0      UploadCrashlyticsSymbols.run (package:flutterfire_cli/src/commands/upload_symbols.dart:406:7)
        <asynchronous suspension>
        #1      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
        <asynchronous suspension>
        #2      main (file:///Users/user/.pub-cache/hosted/pub.dev/flutterfire_cli-1.0.0/bin/flutterfire.dart:63:5)
        <asynchronous suspension>
        Command PhaseScriptExecution failed with a nonzero exit code

BTW, on Runner target everything works fine. Also, w/o FlutterFire build phase it works fine on custom iOS target also.

Steps to reproduce

  1. run flutterfire configure for iOS, which setups config files, autocreates build phase
  2. flutter run works fine
  3. duplicate Runner target. It will be Runner copy
  4. copy-paste target 'Runner' do .... end for the new Runner copy
  5. copy-paste configuration Debug, set the name to Debug-Runner copy
  6. flutter run --flavor "Runner copy" gives an error PhaseScriptExecution
  7. remove FlutterFire build phase for Runner copy
  8. flutter run --flavor "Runner copy" works fine

Expected behavior

flutter run --flavor "Runner copy" works fine within the FlutterFire build phase

Screenshots

No response

Additional context and comments

I need the extra target for integration testing. So currently I was needed to return the old firebase jsons: firebase_app_id_file.json, and the old crashlytics build phase, just for that target.

russellwheatley commented 1 month ago

@muknta

Steps to reproduce

  1. run flutterfire configure for iOS, which setups config files, autocreates build phase
  2. flutter run works fine
  3. duplicate Runner target. It will be Runner copy
  4. copy-paste target 'Runner' do .... end for the new Runner copy
  5. copy-paste configuration Debug, set the name to Debug-Runner copy
  6. flutter run --flavor "Runner copy" gives an error PhaseScriptExecution
  7. remove FlutterFire build phase for Runner copy
  8. flutter run --flavor "Runner copy" works fine

is step 5 copy-paste from firebase.json? You shouldn't do that.

Please explain further exactly what you're doing as it isn't clear to me.

muknta commented 1 month ago

@russellwheatley I don't do anything with firebase.json in this case. The 5th step - I am copying the iOS Debug configuration from existing one. I need an extra configuration Debug-Runner copy, so it will be used for flutter flavor Runner copy

image image
russellwheatley commented 1 month ago

Did you configure the additional target? If you create a new target, you would need to also run flutterfire configure for it as well.

muknta commented 1 month ago

@russellwheatley I've just tried to configure by command

flutterfire configure --ios-target="Runner copy"

It's adding the firebase_options.dart, but it doesn't create the Build Phase FlutterFire: "flutterfire upload-crashlytics-symbols". If I create this phase by myself, it won't work.

russellwheatley commented 1 month ago

If you want to create a reproduction repo containing a stripped out version of your app, I can take a look. I can't really solve your issue without it as I have no idea why it isn't creating the script in your build phases.

muknta commented 4 weeks ago

Hi @russellwheatley! I created the repo for that. Please take a chance to look into: https://github.com/muknta/issue_flutterfire_ios_flavor