Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EAS Build failing iOS production builds #2058

Closed
alessandrocapra opened this issue Sep 20, 2023 · 3 comments
Closed

EAS Build failing iOS production builds #2058

alessandrocapra opened this issue Sep 20, 2023 · 3 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@alessandrocapra
Copy link

alessandrocapra commented Sep 20, 2023

Build/Submit details page URL

https://expo.dev/accounts/quantoz/projects/qbs-test-app/builds/fbf0460d-bf13-410d-8f73-3d1fcd5d1a15

Summary

Note: the Android app builds correctly with this config, it's an iOS issue

The iOS production build fails with the following:

Configuring Xcode project

Assigning provisioning profile '*[expo] com.*******.*** AppStore 2023-03-27T09:36:37.150Z' (Apple Team ID: --------) to target 'AppName'

Could not find target 'AppName' in project.pbxproj

Some context:

After upgrading to Expo SDK 49, I have refactored my project to use different env files, per environment and also whether it has to be used locally or for builds. I have the following:

  • .env.development.local
  • .env.production.local (to test prod setup locally if needed)
  • .env.local (shared stuff between them)

I used eas secret to upload the latter two in order to be used also for builds, since they contain secrets I don't want in my repo.

I just added two more env files:

  • .env.development
  • .env.production

These are uploaded to the repo, and they contain info on package name, app name... Note: the app name is exactly the same as before

My eas.json:

{
  "cli": {
    "version": ">= 2.2.1",
    "appVersionSource": "remote"
  },
  "build": {
    "development": {
      "channel": "development",
      "developmentClient": true,
      "distribution": "internal",
      "ios": {
        "simulator": true
      },
      "env": {
        "APP_ENV": "development",
        "APP_NAME": "Dev App Name",
        "IOS_BUNDLE_IDENTIFIER": "com.company.app.dev",
        "ANDROID_PACKAGE_NAME": "com.company.app.dev",
        "SCHEME": "quantoz.qbs.dev"
      }
    },
    "production": {
      "autoIncrement": true,
      "channel":"test",
      "distribution": "store",
      "env": {
        "APP_ENV": "production",
        "APP_NAME": "App Name",
        "IOS_BUNDLE_IDENTIFIER": "com.company.app",
        "ANDROID_PACKAGE_NAME": "com.company.app",
        "SCHEME": "company.app"
      }
    }
  },
  "submit": {
    "test": {
      "android": {
        "serviceAccountKeyPath": "./google-service-account.json",
        "track": "internal"
      },
      "ios": {
        "ascAppId": "XXXXXXXXXX"
      }
    }
  }
}

app.config.ts:

const AppConfig = {
  name: process.env.APP_NAME,
  icon: "./assets/icon-qbs.png",
  image: "./assets/splash-qbs.png",
  ios: {
    // from .env.production
    bundleIdentifier: process.env.IOS_BUNDLE_IDENTIFIER,
  },
  android: {
    adaptiveIcon: {
      foregroundImage: "./assets/adaptive-icon-qbs.png",
    },
    // from .env.production
    package: process.env.ANDROID_PACKAGE_NAME,
  },
  extra: {
    // from EAS Secrets
    POSTMAN_MOCK_API_KEY: process.env.POSTMAN_MOCK_API_KEY,
    POSTMAN_MOCK_API_URL: process.env.POSTMAN_MOCK_API_URL,
    API_URL: process.env.API_URL,
    ...
    APP_ENV: process.env.APP_ENV || null,
    ...
  },
};

export default () => ({
  expo: {
    name: AppConfig.name,
    slug: "app-slug-here",
    version: "1.0.0",
    orientation: "portrait",
    icon: AppConfig.icon,
    userInterfaceStyle: "light",

    splash: {
      image: "./assets/splash-qbs.png",
      resizeMode: "contain",
      backgroundColor: "#ffffff",
    },
    updates: {
      fallbackToCacheTimeout: 1500,
      url: "https://u.expo.dev/508103fd-4d90-4213-98d1-045bdcd043b5",
    },
    assetBundlePatterns: ["**/*"],
    ios: {
      bundleIdentifier: AppConfig.ios.bundleIdentifier,
      infoPlist: {
        NSCameraUsageDescription:
          "This app uses the camera to take photos of your documents, in order to upgrade to a higher tier.",
        NSFaceIDUsageDescription:
          "FaceID is used to authenticate you and to access your account",
      },
    },
    android: {
      adaptiveIcon: {
        foregroundImage: AppConfig.android.adaptiveIcon.foregroundImage,
        backgroundColor: "#FFFFFF",
      },
      package: AppConfig.android.package,
    },
    owner: "company",
    web: {
      favicon: "./assets/favicon.png",
    },
    extra: {
      eas: {
        projectId: "508103fd-4d90-4213-98d1-045bdcd043b5",
      },
      ...AppConfig.extra,
    },
    plugins: [
      "sentry-expo",
      [
        "expo-image-picker",
        {
          photosPermission:
            "The app accesses your photos to let you upload the necessary documentation.",
        },
      ],
    ],
    scheme: process.env.SCHEME,
    platforms: ["ios", "android"],
    runtimeVersion: {
      policy: "sdkVersion",
    },
    hooks: {
      postPublish: [
        {
          file: "sentry-expo/upload-sourcemaps",
          config: {
            organization: process.env.SENTRY_ORG,
            project: process.env.SENTRY_PROJECT,
          },
        },
      ],
    },
  },
});

Managed or bare?

Managed

Environment

expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.1
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
      Yarn: 1.22.15 - ~/.nvm/versions/node/v16.15.0/bin/yarn
      npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
      Watchman: 2023.04.17.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    IDEs:
      Android Studio: 2021.3 AI-213.7172.25.2113.9123335
      Xcode: 14.3/14E222b - /usr/bin/xcodebuild
    npmPackages:
      @expo/metro-config: ^0.10.7 => 0.10.7
      expo: ^49.0.10 => 49.0.10
      react: 18.2.0 => 18.2.0
      react-dom: 18.2.0 => 18.2.0
      react-native: 0.72.4 => 0.72.4
    npmGlobalPackages:
      eas-cli: 5.2.0
      expo-cli: 6.3.9
    Expo Workflow: managed
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✖ Check that native modules use compatible support package versions for installed Expo SDK
✖ Check that packages match versions required by installed Expo SDK

Detailed check results:

Expected package @expo/config-plugins@~7.2.2
Found invalid:
  @expo/[email protected]
  (for more info, run: npm why @expo/config-plugins)
Advice: Upgrade dependencies that are using the invalid package versions.

Some dependencies are incompatible with the installed expo version:
  [email protected] - expected version: ~2.4.10
  [email protected] - expected version: ~0.18.13
Your project may not work correctly until you install the correct versions of the packages.
Fix with: npx expo install --fix
Found outdated dependencies
Advice: Use 'npx expo install --check' to review and upgrade your dependencies.

One or more checks failed, indicating possible issues with the project.

Error output

Configuring Xcode project

Assigning provisioning profile '*[expo] com.*******.*** AppStore 2023-03-27T09:36:37.150Z' (Apple Team ID: --------) to target 'AppName'

Could not find target 'AppName' in project.pbxproj

Reproducible demo or steps to reproduce from a blank project

Not easy to do so, but I provided my whole config and can provide more

@alessandrocapra alessandrocapra added the needs review Issue is ready to be reviewed by a maintainer label Sep 20, 2023
@brentvatne
Copy link
Member

hi there! I would recommend fixing the doctor warning about the config plugins version misalignment. that may be related.

in general, this guide is a useful place to go for troubleshooting these issues: https://docs.expo.dev/build-reference/troubleshooting/

if you're still stuck after that, there are some tips on the bottom of the guide for getting further help

@alessandrocapra
Copy link
Author

alessandrocapra commented Oct 5, 2023

Hello @brentvatne , I fixed the issues mentioned by the doctor warning and tried to create another build, but still failing for the same reason: build --> https://expo.dev/accounts/quantoz/projects/qbs-test-app/builds/cbd4e230-b06e-4383-b139-b802ce0d7e0e

npx expo-doctor

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules use compatible support package versions for installed Expo SDK

Didn't find any issues with the project!

expo-env-info

expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 13.1
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
      Yarn: 1.22.15 - ~/.nvm/versions/node/v16.15.0/bin/yarn
      npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
      Watchman: 2023.04.17.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    IDEs:
      Android Studio: 2021.3 AI-213.7172.25.2113.9123335
      Xcode: 14.3/14E222b - /usr/bin/xcodebuild
    npmPackages:
      @expo/metro-config: ^0.10.7 => 0.10.7
      expo: ^49.0.13 => 49.0.13
      react: 18.2.0 => 18.2.0
      react-dom: 18.2.0 => 18.2.0
      react-native: 0.72.5 => 0.72.5
    npmGlobalPackages:
      eas-cli: 5.4.0
      expo-cli: 6.3.9
    Expo Workflow: managed

@alessandrocapra
Copy link
Author

I solved it, my issue was the way in which I handled some env variables. I was using the EXPO_PUBLIC prefix and somehow removing it made it work, when using them inside the app.config.ts file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants