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-cli@11 breaks environment variable resolution #2519

Closed
djMax opened this issue Aug 27, 2024 · 7 comments
Closed

eas-cli@11 breaks environment variable resolution #2519

djMax opened this issue Aug 27, 2024 · 7 comments
Labels
bug Something isn't working eas build issue accepted

Comments

@djMax
Copy link

djMax commented Aug 27, 2024

Build/Submit details page URL

No response

Summary

I have an eas.json like so:

{
  "cli": {
    "version": ">= 7.0.0"
  },
  "build": {
    "development": {
      "developmentClient": true,
      "channel": "development",
      "env": {
        "EXPO_PUBLIC_APP_TYPE": "flavora",
        "EXPO_PUBLIC_APP_ENV": "development",
      }
    },

and so on. In v10, these environment variables are correctly given to app.config.ts to do its job of building a dynamic environment aware config. In version 11, this has stopped working an no environment variables are defined, breaking generation of app.config.

Managed or bare?

managed

Environment

  expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.6.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.12.2 - ~/.local/share/mise/installs/node/20/bin/node
      Yarn: 3.8.1 - ~/.local/share/mise/installs/node/20/bin/yarn
      npm: 10.5.0 - ~/.local/share/mise/installs/node/20/bin/npm
    Managers:
      CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5
    IDEs:
      Android Studio: 2023.2 AI-232.10300.40.2321.11668458
      Xcode: 15.4/15F31d - /usr/bin/xcodebuild
    npmGlobalPackages:
      eas-cli: 11.0.0
    Expo Workflow: managed

Error output

Project config: Slug for project identified by "extra.eas.projectId" (myapp-flavora) does not match the "slug" field (myapp-undefined). Learn more

Reproducible demo or steps to reproduce from a blank project

I do not yet have one. This is a pretty major undocumented breaking change, so would love to either get a rationale or place to look first.

@djMax djMax added the needs review Issue is ready to be reviewed by a maintainer label Aug 27, 2024
@itajenglish
Copy link

+1 Experiencing the same issue

@IjzerenHein
Copy link

Same here, we are trying to access the env-vars that are set by eas-cli in app.config.ts but it's no longer possible as of version 11

szdziedzic added a commit that referenced this issue Aug 27, 2024
… from eas build command (#2521)

<!-- If this PR requires a changelog entry, add it by commenting the PR with the command `/changelog-entry [breaking-change|new-feature|bug-fix|chore] [message]`. -->
<!-- You can skip the changelog check by labeling the PR with "no changelog". -->

# Why

#2519

I was able to reproduce the issue and it is indeed true. It seems like we mistakenly added a static project config definition to the `eas build` command context in 56510f0#diff-cd2e00f4d286a4714f8736e14c635f4c3b98c402367cd71a83e4cd743034bd79. The output from it wasn't really used anywhere, but adding it caused the app configs to be evaluated without `buildProfile.env` in the first pass when trying the resolve project ID and slug at the begging of command execution and our slug/project ID assertions to fail. It only affected people with dynamic project IDs and slug fields.

# How

Remove unnecessary static context from context definitions, therefore avoid resolving project ID and slug from app config without env vars as a first thing when the `eas build` command is executed.

# Test Plan

Tested manually
@szdziedzic
Copy link
Member

Thanks for the report!

I was able to replicate the issue. This was indeed an unintended change, sorry about this. We added a static app config context definition to the eas build command in 56510f0#diff-cd2e00f4d286a4714f8736e14c635f4c3b98c402367cd71a83e4cd743034bd79, it caused eas build to try to resolve the project ID and slug from dynamic app.config.ts file without using env vars, which was the root cause of the issue in your case.

#2521 should fix it.

It seems like the issue affected projects with dynamic slug/projectId fields in app.config.ts

@szdziedzic szdziedzic added eas build bug Something isn't working issue accepted and removed needs review Issue is ready to be reviewed by a maintainer labels Aug 27, 2024
@expo-bot
Copy link
Contributor

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@szdziedzic
Copy link
Member

The issue should be fixed in version 11.0.2 that is just being published. Let me know if it works for you in this version.

@IjzerenHein
Copy link

IjzerenHein commented Aug 27, 2024

I switched the eas-version back to latest for our expo/expo-github-action. Everything is working again 👍
Thank you for the quick fix! 👏

@djMax
Copy link
Author

djMax commented Aug 27, 2024

Well done Expo team!

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

No branches or pull requests

7 participants
@djMax @itajenglish @IjzerenHein @expo-bot @szdziedzic and others