expo / eas-cli

Fastest way to build, submit, and update iOS and Android apps
https://docs.expo.dev/eas/
MIT License
828 stars 84 forks source link

Builds breaking between expo-cli v0.58 and v0.59 #1317

Open RWOverdijk opened 2 years ago

RWOverdijk commented 2 years ago

Appologies for using a blank issue. I just wanted to stop bumping in discord. Also hoping this attracts other people with the same issue.

When running a build (local and remote) I get:

Error: [ios.infoPlist]: withIosInfoPlistBaseMod: ENOENT: no such file or directory, open '/Users/spiderclam/projects/mobile/projectname/GoogleService-Info.plist' Code: ENOENT

This makes sense, because the file doesn't exist until after eas-build-pre-install (That's where I place the correct GoogleService files based on the profile used).

So, for some reason it's running a config plugin before it should be running a plugin.

I've narrowed it down to somewhere between v0.58 and v0.59, since v0.59 (and later releases, too) is where the issue starts popping up.

Additional remarks:

dsokal commented 2 years ago

Can you share a link to the failing build?

RWOverdijk commented 2 years ago

@dsokal No, because it never gets uploaded. This error shows up locally.

This runs before eas-build-pre-install, which itself shouldn't run until the build starts afaik. This error shows up immediately after running build. I'll add the full output below (so you can see the order of things which might be helpful?):

Preparation:

$ npm i -g eas-cli@v0.59
// Boring output

Note: Anything above v0.59 (tested up to v1.1.1 has the exact same behaviour._

Local:

$ eas build --profile production --local
★ eas-cli@1.1.1 is now available.
To upgrade, run npm install -g eas-cli.
Proceeding with outdated version.

✔ Select platform › iOS
✔ Linked to project @myorg/MyProject
    Error: [ios.infoPlist]: withIosInfoPlistBaseMod: ENOENT: no such file or directory, open '/Users/spiderclam/projects/mobile/projectname/GoogleService-Info.plist'
    Code: ENOENT

EAS:

$ eas build --profile production
★ eas-cli@1.1.1 is now available.
To upgrade, run npm install -g eas-cli.
Proceeding with outdated version.

✔ Select platform › iOS
✔ Linked to project @myorg/MyProject
    Error: [ios.infoPlist]: withIosInfoPlistBaseMod: ENOENT: no such file or directory, open '/Users/spiderclam/projects/mobile/projectname/GoogleService-Info.plist'
    Code: ENOENT
dsokal commented 2 years ago

When running a non-local build, the eas-build-pre-install script is only executed in the cloud. See the docs https://docs.expo.dev/build-reference/ios-builds/#remote-steps

Probable solution:

RWOverdijk commented 2 years ago

@dsokal

  1. This is a breaking change.
  2. eas-build-pre-install is being called locally (on 0.58 at least) so what you're saying isn't true.
  3. The issue isn't just with local. With the risk of sounding rude (not meant rude), I don't feel like you've read everything I wrote.

Proof of point 2 (output when running using --local):

[PRE_INSTALL_HOOK] Script 'eas-build-pre-install' is present in package.json, running it...

But I want to repeat, this isn't just about --local. This is about any eas build

dsokal commented 2 years ago

This is a breaking change.

What is a breaking change?

eas-build-pre-install is being called locally (on 0.58 at least) so what you're saying isn't true.

It's called locally only if you run local builds.

I don't feel like you've read everything I wrote.

Vice versa. Please read my comment again https://github.com/expo/eas-cli/issues/1317#issuecomment-1228204303

RWOverdijk commented 2 years ago

What is a breaking change?

It works on 0.58. It doesn't on 0.59. Something broke for me that's why I call it a breaking change. I don't know the change is that broke things for me though, that's what I want to find out 😄

It's called locally only if you run local builds. Vice versa. Please read my comment again

My bad, I read your comment and you're right, I missed the "non-" part. But that's still not the actual issue.

The problem is not eas-build-pre-install. The problem is that it's looking for a file (from a config plugin I think?) before even starting the build.

So like you said:

When running a non-local build, the eas-build-pre-install script is only executed in the cloud.

This sounds perfectly logical to me. But before it gets to running a build, something is already looking for a file. It shouldn't do that and before v0.59 it didn't.

dsokal commented 2 years ago

I see, I can see we upgraded a bunch of packages in 0.59. You could be right. Can you share your app.json/app.config.js?

dsokal commented 2 years ago

Also, I'm aware this could be a breaking change but what do you think about the solution I propose above?

Keep GoogleService-Info.plist in the project dir locally. If you don't want to have this file uploaded to EAS Build, add it to .gitignore.

It's not the "fix" but it should unblock you.

RWOverdijk commented 2 years ago

@dsokal Sure thing.

I do want to note that I already tried removing the entire "plugins" key from the config with the same result. The reason I mention this is because I have a custom plugin in that list, so that's the first thing I tried.

{
  "expo": {
    "backgroundColor": "#ffffff",
    "owner": "ltodev",
    "name": "LTO Dichtbij",
    "slug": "LTO",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/app-icons/icon.png",
    "splash": {
      "image": "./assets/app-icons/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "enabled": false,
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "config": {
        "usesNonExemptEncryption": false
      },
      "associatedDomains": [
        "applinks:ltodichtbij.nl",
        "applinks:landing.test.ltodichtbij.nl"
      ],
      "bundleIdentifier": "nl.ltodichtbij.app",
      "googleServicesFile": "./GoogleService-Info.plist",
      "supportsTablet": false,
      "buildNumber": "57"
    },
    "android": {
      "intentFilters": [
        {
          "action": "VIEW",
          "data": [
            {
              "scheme": "https",
              "host": "*.ltodichtbij.nl",
              "pathPrefix": "/link"
            }
          ],
          "category": [
            "BROWSABLE",
            "DEFAULT"
          ]
        }
      ],
      "package": "nl.ltodichtbij.app",
      "googleServicesFile": "./google-services.json",
      "adaptiveIcon": {
        "foregroundImage": "./assets/app-icons/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "versionCode": 23
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "plugins": [
      "@react-native-firebase/app",
      "@react-native-firebase/crashlytics",
      "./plugins/analytics/disable-ad-id.js"
    ],
    "extra": {
      "eas": {
        "projectId": "b6b896b3-0cd2-47cd-b64a-b4aaa8a33f4c"
      }
    }
  }
}
RWOverdijk commented 2 years ago

It's not the "fix" but it should unblock you.

I've thought about that, but I use eas.json to pick the right file based on the profile. I could move the copy to a bunch of npm scripts instead as a workaround for now?

Or do you mean, even if it's empty I could have the file there for now to shut up the error?

dsokal commented 2 years ago

Or do you mean, even if it's empty I could have the file there for now to shut up the error?

It's definitely worth trying.

RWOverdijk commented 2 years ago

I'll try that. Any way I can find the source of this as well?

dsokal commented 2 years ago

What do you mean?

RWOverdijk commented 2 years ago

I mean, the source of what is trying to find that file. Which package has the withIosInfoPlistBaseMod that is doing this.

I want to help find the source of the issue so I can be a good open source citizen 😄

mrtry commented 2 years ago

I have a similar problem.

I am running a local build on GitHub Actions. I had to use eas-build-pre-install to run a script to get GoogleService-Info.plist etc from GCP Secret Manager (setup.sh).

In Android's eas build, setup.sh is executed in ease-build-pre-install after fetching JKS and other files.

Android build log ``` Found eas-cli in your project dependencies. It's recommended to use the "cli.version" field in eas.json to enforce the eas-cli version for your project. Learn more: https://github.com/expo/eas-cli#enforcing-eas-cli-version-for-your-project It looks like that you are using a custom metro.config.js that does not extend @expo/metro-config. This can result in unexpected and hard to debug issues, like missing assets in the production bundle. Learn more on customizing Metro: https://docs.expo.dev/guides/customizing-metro/ You've run EAS CLI in non-interactive mode, proceeding... ✔ Using remote Android credentials (Expo server) ✔ Using Keystore from configuration: Build Credentials 4e9yuk3Moc (default) npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated xmldom@0.1.[31](https://github.com/BonBon/aiseki_native/runs/8292228235?check_suite_focus=true#step:8:32): Deprecated due to CVE-2021-21[36](https://github.com/BonBon/aiseki_native/runs/8292228235?check_suite_focus=true#step:8:37)6 resolved in 0.5.0 npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm WARN deprecated subscriptions-transport-ws@0.9.8: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x. npm WARN deprecated graphql-tools@3.0.0: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead [SETUP_WORKINGDIR] Preparing workingdir /tmp/runner/eas-build-local-nodejs/562b107a-06bc-4fef-9998-[38](https://github.com/BonBon/aiseki_native/runs/8292228235?check_suite_focus=true#step:8:39)f7faea58a1 [START_BUILD] Starting build ... ```

However, in the iOS eas build, the GoogleService-Info.plist check is performed first, and I get Error: [ios.infoPlist]: withIosInfoPlistBaseMod: ENOENT: no such file or directory.

iOS build log ``` Found eas-cli in your project dependencies. It's recommended to use the "cli.version" field in eas.json to enforce the eas-cli version for your project. Learn more: https://github.com/expo/eas-cli#enforcing-eas-cli-version-for-your-project Error: [ios.infoPlist]: withIosInfoPlistBaseMod: ENOENT: no such file or directory, open '/Users/runner/work/aiseki_native/aiseki_native/GoogleService-Info.plist' Code: ENOENT Error: Process completed with exit code 1. ```

Tool versions

However, I have found workaround. It seems to work if I put GoogleService-Info.plist in the directory before running npx eas build --platform ios--local --profile preview --non-interactive.

In my case.

When I did this workaround, eas-build-pre-install was also executed when building iOS. For Android, it seems that eas-build-pre-install is executed without this workaround.

I have not investigated the code to the bug, but I hope this helps. 🙏

acrdlph commented 1 year ago

I have the same issue ... it only works if I include a non-empty GoogleService-Info.plist file in the repository / before the eas-build-pre-install

danshilm commented 1 year ago

Facing this too on v3.3.2 for iOS only and my setup is very similar to OP's: My pre-install hook creates the GoogleService-Info.plist file from an environment variable. I first came across this when setting up Expo Github Action since the CI environment doesn't have a GoogleService-Info.plist file present like my machine does. Might be worth noting that the file is in my .gitignore and .easignore.

However, when uploading the file as a secret file to EAS , the build starts (and successfully builds my app) just fine, so I'll be using this as my workaround for now.

akhenda commented 1 year ago

This also fails for me on GitHub Actions.

rgomezp commented 7 months ago

This just started failing for me on Github Actions also

christianledgard commented 7 months ago

Same issue on Github Actions also

RWOverdijk commented 7 months ago

I don't know if it's the same anymore, I don't even remember this issue. So I'm muting notifications and leave it up to you + maintainers to deal with this :D Good luck all <3

rgomezp commented 7 months ago

I have the same issue ... it only works if I include a non-empty GoogleService-Info.plist file in the repository / before the eas-build-pre-install

To add further context, I see the same thing but working around the issue breaks it on the other platform...

To fix iOS, I add a step to run the eas_pre_install script myself before the build step.

    - name: 📂 Setup Google Services Files
      env:
        GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
        GOOGLE_SERVICES_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICES_PLIST_BASE64 }}
      run: ./scripts/eas_pre_install

    - name: 👷 Build app
      env:
        GOOGLE_SERVICES_JSON: ${{ vars.GOOGLE_SERVICES_JSON }}
        GOOGLE_SERVICES_PLIST: ${{ vars.GOOGLE_SERVICES_PLIST }}
        EXPO_PUBLIC_FIREBASE_WEB_CLIENT_ID: ${{ secrets.EXPO_PUBLIC_FIREBASE_WEB_CLIENT_ID }}
      run: |
        eas build --local \
          --non-interactive \
          --output=./app-build \
          --platform=${{ github.event.inputs.platform }} \
          --profile=${{ github.event.inputs.profile }}

This works around the issue on iOS, but now breaks for Android...

I now get:

[PREBUILD] [Error: ENOENT: no such file or directory, open '/tmp/runner/eas-build-local-nodejs/7a56da89-d12d-4d48-b594-1d3730b0b21d/build/googleServices/google-services.json'] {
[PREBUILD] Error: [android.dangerous]: withAndroidDangerousBaseMod: Cannot copy google-services.json from /tmp/runner/eas-build-local-nodejs/7a56da89-d12d-4d48-b594-1d3730b0b21d/build/googleServices/google-services.json to /tmp/runner/eas-build-local-nodejs/7a56da89-d12d-4d48-b594-1d3730b0b21d/build/android/app/google-services.json. Please make sure the source and destination paths exist.
✖ Config sync failed

I think there's a discrepancy between where each respective build looks at for the local files.

On Android, the config looks at /tmp/runner/eas-build-local-nodejs/7a56da89-d12d-4d48-b594-1d3730b0b21d/build/googleServices whereas for iOS, it works with /home/runner/work/MyApp/MyApp/googleServices

cc @EvanBacon