Skip to content

[eas-cli] Fix credentials manager failing on simulator build profiles - #4183

Open
giaBaoJS wants to merge 1 commit into
expo:mainfrom
giaBaoJS:fix-ios-credentials-simulator-profile-push-key
Open

[eas-cli] Fix credentials manager failing on simulator build profiles#4183
giaBaoJS wants to merge 1 commit into
expo:mainfrom
giaBaoJS:fix-ios-credentials-simulator-profile-push-key

Conversation

@giaBaoJS

Copy link
Copy Markdown

Why

Fixes #4109.

In the interactive eas credentials flow for iOS, picking a build profile with ios.simulator: true makes every project-scoped action other than "All: Set up all the required credentials to build your project" fail with:

Error: A simulator distribution does not require credentials to be configured.

The reported case is Push Notifications → Set up your project to use Push Notifications, which fails even though the same profile's build credentials (distribution certificate + ad hoc provisioning profile) were created successfully moments earlier in the same session.

Push keys and App Store Connect API keys are app-level credentials — they are registered per app, not per build distribution type — so they should not be gated by the simulator check at all. The same profile shape (distribution: "internal" + ios.simulator: true) is the documented pattern for development-client builds that also target the simulator, so this is easy to hit.

How

ManageIos.runProjectSpecificActionAsync resolved the distribution type eagerly for every action except SetUpBuildCredentials (which has its own early return), and SelectIosDistributionTypeGraphqlFromBuildProfile.runAsync throws whenever buildProfile.simulator is set. But only a subset of the actions ever read that value.

Enumerating every project-scoped IosActionType that reaches this method:

Action Reads distributionType?
SetUpBuildCredentials no (already returned early before this change)
SetUpBuildCredentialsFromCredentialsJson yes
UpdateCredentialsJson yes
UseExistingDistributionCertificate yes
CreateDistributionCertificate yes
RemoveProvisioningProfile yes
SetUpPushKey no
CreatePushKey no
UseExistingPushKey no
SetUpAscApiKeyForSubmissions no
UseExistingAscApiKeyForSubmissions no
CreateAscApiKeyForSubmissions no

The eager resolution is replaced with a lazy one that each branch awaits only when it actually needs the value. That keeps the simulator guard in place for the five actions that genuinely depend on a distribution type, and unblocks the six app-level ones. This is the first option suggested in the issue.

SelectIosDistributionTypeGraphqlFromBuildProfile itself is unchanged — the simulator throw is intentional for that class and its existing test still passes untouched.

Test Plan

New unit tests in packages/eas-cli/src/credentials/manager/__tests__/ManageIos-test.ts:

  • SetUpPushKey on a { distribution: 'internal', simulator: true } profile now runs SetUpPushKey with the right app lookup params (the exact scenario from the issue).
  • A parameterized case asserting all six app-level actions above resolve without throwing on a simulator profile.
  • Non-vacuity: UpdateCredentialsJson on a { distribution: 'store' } profile still receives IosDistributionType.APP_STORE, so the fix cannot degenerate into "never resolve a distribution type".
  • Regression guard: UpdateCredentialsJson on a simulator profile still rejects with A simulator distribution does not require credentials to be configured. and never constructs UpdateCredentialsJson.

Counterfactual check — with the change to ManageIos.ts reverted and the new tests kept, the 7 simulator cases fail with exactly A simulator distribution does not require credentials to be configured., while the 2 guard tests stay green:

✕ sets up a push key for a build profile with a simulator distribution
✕ does not require a distribution type for SetUpPushKey on a simulator build profile
✕ does not require a distribution type for CreatePushKey on a simulator build profile
✕ does not require a distribution type for UseExistingPushKey on a simulator build profile
✕ does not require a distribution type for SetUpAscApiKeyForSubmissions on a simulator build profile
✕ does not require a distribution type for UseExistingAscApiKeyForSubmissions on a simulator build profile
✕ does not require a distribution type for CreateAscApiKeyForSubmissions on a simulator build profile
✓ still resolves the distribution type for actions that need it
✓ still rejects a simulator distribution for actions that need a distribution type

Tests: 7 failed, 2 passed, 9 total

With the change applied:

✓ sets up a push key for a build profile with a simulator distribution
✓ does not require a distribution type for SetUpPushKey on a simulator build profile
✓ does not require a distribution type for CreatePushKey on a simulator build profile
✓ does not require a distribution type for UseExistingPushKey on a simulator build profile
✓ does not require a distribution type for SetUpAscApiKeyForSubmissions on a simulator build profile
✓ does not require a distribution type for UseExistingAscApiKeyForSubmissions on a simulator build profile
✓ does not require a distribution type for CreateAscApiKeyForSubmissions on a simulator build profile
✓ still resolves the distribution type for actions that need it
✓ still rejects a simulator distribution for actions that need a distribution type

Tests: 9 passed, 9 total

Full packages/eas-cli suite, before and after:

# before (main)
Test Suites: 2 failed, 281 passed, 283 total
Tests:       4 failed, 4 skipped, 2393 passed, 2401 total

# after
Test Suites: 2 failed, 282 passed, 284 total
Tests:       4 failed, 4 skipped, 2402 passed, 2410 total

The two failing suites (src/observe/__tests__/formatCustomEvents.test.ts, src/observe/__tests__/formatEvents.test.ts) fail identically on an unmodified main — they are locale-dependent date-format snapshots unrelated to this change.

yarn typecheck, yarn lint (0 errors) and yarn fmt:check are clean.

@giaBaoJS
giaBaoJS force-pushed the fix-ios-credentials-simulator-profile-push-key branch from 4b98d4e to f347b86 Compare August 13, 2026 14:00
@github-actions

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
packages/eas-cli/** @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

Push keys and App Store Connect API keys are app-level credentials and do
not depend on the build distribution type, but `eas credentials` resolved
the iOS distribution type up front for every project-scoped action. On a
build profile with `ios.simulator: true` that resolution throws, so
managing those credentials failed with "A simulator distribution does not
require credentials to be configured.".

Resolve the distribution type lazily, so only the actions that consume it
(credentials.json sync, distribution certificate and provisioning profile
actions) are gated by that check.

Fixes expo#4109
@giaBaoJS
giaBaoJS force-pushed the fix-ios-credentials-simulator-profile-push-key branch from f347b86 to 9c8a8a4 Compare August 18, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant