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 submit does not use environment variables from eas.json #835

Closed
gerwim opened this issue Dec 9, 2021 · 6 comments
Closed

eas submit does not use environment variables from eas.json #835

gerwim opened this issue Dec 9, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@gerwim
Copy link

gerwim commented Dec 9, 2021

Summary

When running eas submit --platform ios --profile tst --latest it returns an error.

Managed or bare?

Managed

Environment

EAS CLI 0.40.0 environment info:
System:
OS: Windows 10 10.0.22000
Binaries:
Node: 14.18.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.15 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.14.15 - C:\Program Files\nodejs\npm.CMD
Utilities:
Git: 2.31.1.
npmPackages:
@expo/webpack-config: ^0.16.2 => 0.16.4
expo: ^43.0.0 => 43.0.0
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
react-native: 0.64.3 => 0.64.3
react-native-web: 0.17.1 => 0.17.1
Project workflow: managed

Error output

Failed to resolve bundleIdentifier in the Xcode project: Specify "ios.bundleIdentifier" in app.config.ts or app.json and run this command again..
Specify "ios.bundleIdentifier" in app.config.ts or app.json and run this command again.

Reproducible demo or steps to reproduce from a blank project

Init an EAS project with the following files:

eas.json

{
    "cli": {
      "version": ">= 0.38.3"
    },
    "build": {
      "development": {
        "developmentClient": true,
        "distribution": "internal"
      },
      "preview": {
        "distribution": "internal"
      },
      "tst": {
        "env": {
            "BUNDLE_IDENTIFIER": "my.app.development"
          }
      }
    },
    "submit": {
      "tst": {}
    }
  }

app.config.js

export default ({ config }) => {
    return {
        ...config,
        ios: {
            ...config.ios,
            bundleIdentifier: process.env.BUNDLE_IDENTIFIER,
        }
    };
};

It's probably the same underlying issue as #820.

When running an eas build with --auto-submit it works. But running eas submit seperately from the build does not.

@gerwim gerwim added the bug Something isn't working label Dec 9, 2021
@brentvatne
Copy link
Member

brentvatne commented Dec 12, 2021

this is expected behavior. we may need to document this more clearly, currently it's documented here: https://docs.expo.dev/build/automating-submissions/#build-profile-environment-variables-and-submissions

@hfllr
Copy link

hfllr commented Jul 23, 2022

Posting here because it's not an issue but more a inconsistency in the docs @brentvatne : here is described: "Remove any code that references Constants.manifest. That will now always return null." but here it is described how to get the env variables from eas.json using Constants.manifest (which is not working).

Sorry if it's the wrong place to share this, but I wasn't sure where to post this. Its driving me crazy because I couldnt figure out a way to retreive the env variables of eas.json

@Userrrfriendly
Copy link

@hfllr So did you have any luck retrieving the env variables of eas.json? I'm still struggling with this issue.

@bartvanandel
Copy link

We are having a bit of trouble getting eas submit to use the correct configuration due to this lack of support for env in the submit configuration as well.

We use some logic in app.config.ts to create an runtime environment specific app id (e.g. "com.example.app" for prod, "com.example.app.dev" for dev; same with app name so Apple doesn't complain). However, this only works for eas build and eas update (last one untested by us so far). It would be very beneficial if environment can be read from the submit config as well, e.g.:

{
  build: {...},
  submit: {
    base: {...},
    dev: {
      extends: 'base',
      env: {
        APP_ENV: 'dev'
      },
    },
    prod: {
      extends: 'base',
      env: {
        APP_ENV: 'prod'
      }
    },
    'prod:beta': {
      extends: 'prod',
      android: {
        track: 'internal',
      },
      // etc
    },
  },
}

@hfllr
Copy link

hfllr commented Mar 14, 2023

@Userrrfriendly sorry for the late reply, but no not yet. I'm currently using 'process.env.NODE_ENV' inside the code to make the necessary distinction where needed. This doesn't allow for custom environments, but at least distinguishes dev from prod.

@jessemezini
Copy link

See: https://docs.expo.dev/eas/json/#bundleidentifier

"..but if you have multiple Xcode schemes and targets, this value might be necessary."

"submit": { "staging": { "ios": { "..." "bundleIdentifier": "com.exampledev" } } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants