From d76c1ef549eb1cd6602eaef2ab8cd99d3f72a847 Mon Sep 17 00:00:00 2001 From: Douglas Lowder Date: Fri, 20 Feb 2026 13:13:26 -0800 Subject: [PATCH 1/4] [eas-cli] Require --environment flag for eas update when SDK >= 55 Ensures that server-side environment variables are always explicitly specified for projects using Expo SDK 55 or greater. Co-Authored-By: Claude Opus 4.6 --- packages/eas-cli/src/commandUtils/flags.ts | 2 +- .../commands/update/__tests__/index.test.ts | 61 +++++++++++++++++++ .../eas-cli/src/commands/update/configure.ts | 6 ++ packages/eas-cli/src/commands/update/index.ts | 6 ++ packages/eas-cli/src/update/utils.ts | 17 ++++++ 5 files changed, 91 insertions(+), 1 deletion(-) diff --git a/packages/eas-cli/src/commandUtils/flags.ts b/packages/eas-cli/src/commandUtils/flags.ts index bc108e1550..4e39763d86 100644 --- a/packages/eas-cli/src/commandUtils/flags.ts +++ b/packages/eas-cli/src/commandUtils/flags.ts @@ -67,7 +67,7 @@ export const EasJsonOnlyFlag = { export const EasUpdateEnvironmentFlag = { environment: Flags.string({ description: - 'Environment to use for the server-side defined EAS environment variables during command execution, e.g. "production", "preview", "development"', + 'Environment to use for the server-side defined EAS environment variables during command execution, e.g. "production", "preview", "development". Required for projects using Expo SDK 55 or greater.', required: false, default: undefined, }), diff --git a/packages/eas-cli/src/commands/update/__tests__/index.test.ts b/packages/eas-cli/src/commands/update/__tests__/index.test.ts index dd03a19b82..b0acbc394a 100644 --- a/packages/eas-cli/src/commands/update/__tests__/index.test.ts +++ b/packages/eas-cli/src/commands/update/__tests__/index.test.ts @@ -143,6 +143,67 @@ describe(UpdatePublish.name, () => { expect(PublishMutation.publishUpdateGroupAsync).toHaveBeenCalled(); }); + it('errors when SDK >= 55 and --environment is not provided', async () => { + const flags = ['--non-interactive', '--branch=branch123', '--message=abc']; + + mockTestProject({ expoConfig: { sdkVersion: '55.0.0' } }); + + await expect(new UpdatePublish(flags, commandOptions).run()).rejects.toThrow( + '--environment flag is required for projects using Expo SDK 55 or greater' + ); + }); + + it('does not error when SDK >= 55 and --environment is provided', async () => { + const flags = [ + '--non-interactive', + '--branch=branch123', + '--message=abc', + '--environment=production', + ]; + + mockTestProject({ expoConfig: { sdkVersion: '55.0.0' } }); + const { platforms, runtimeVersion } = mockTestExport(); + + jest.mocked(ensureBranchExistsAsync).mockResolvedValue({ + branch: { + id: 'branch123', + name: 'wat', + }, + createdBranch: false, + }); + + jest + .mocked(PublishMutation.publishUpdateGroupAsync) + .mockResolvedValue(platforms.map(platform => ({ ...updateStub, platform, runtimeVersion }))); + + await new UpdatePublish(flags, commandOptions).run(); + + expect(PublishMutation.publishUpdateGroupAsync).toHaveBeenCalled(); + }); + + it('does not error when SDK < 55 and --environment is not provided', async () => { + const flags = ['--non-interactive', '--branch=branch123', '--message=abc']; + + mockTestProject({ expoConfig: { sdkVersion: '54.0.0' } }); + const { platforms, runtimeVersion } = mockTestExport(); + + jest.mocked(ensureBranchExistsAsync).mockResolvedValue({ + branch: { + id: 'branch123', + name: 'wat', + }, + createdBranch: false, + }); + + jest + .mocked(PublishMutation.publishUpdateGroupAsync) + .mockResolvedValue(platforms.map(platform => ({ ...updateStub, platform, runtimeVersion }))); + + await new UpdatePublish(flags, commandOptions).run(); + + expect(PublishMutation.publishUpdateGroupAsync).toHaveBeenCalled(); + }); + it('creates a new update with the public expo config', async () => { const flags = ['--non-interactive', '--branch=branch123', '--message=abc']; diff --git a/packages/eas-cli/src/commands/update/configure.ts b/packages/eas-cli/src/commands/update/configure.ts index 8b86d4f036..3a617c892b 100644 --- a/packages/eas-cli/src/commands/update/configure.ts +++ b/packages/eas-cli/src/commands/update/configure.ts @@ -11,6 +11,7 @@ import { ensureEASUpdateIsConfiguredAsync, ensureEASUpdateIsConfiguredInEasJsonAsync, } from '../../update/configure'; +import { assertEnvironmentFlagForSdk55OrGreater } from '../../update/utils'; export default class UpdateConfigure extends EasCommand { static override description = 'configure the project to support EAS Update'; @@ -42,6 +43,11 @@ export default class UpdateConfigure extends EasCommand { withServerSideEnvironment: flags['environment'] ?? null, }); + assertEnvironmentFlagForSdk55OrGreater({ + sdkVersion: exp.sdkVersion, + environment: flags['environment'], + }); + Log.log( '💡 The following process will configure your project to use EAS Update. These changes only apply to your local project files and you can safely revert them at any time.' ); diff --git a/packages/eas-cli/src/commands/update/index.ts b/packages/eas-cli/src/commands/update/index.ts index a3deda1632..e61da9b9b7 100644 --- a/packages/eas-cli/src/commands/update/index.ts +++ b/packages/eas-cli/src/commands/update/index.ts @@ -9,6 +9,7 @@ import { ensureRepoIsCleanAsync } from '../../build/utils/repository'; import { getUpdateGroupUrl } from '../../build/utils/url'; import EasCommand from '../../commandUtils/EasCommand'; import { EasNonInteractiveAndJsonFlags, EasUpdateEnvironmentFlag } from '../../commandUtils/flags'; +import { assertEnvironmentFlagForSdk55OrGreater } from '../../update/utils'; import { getPaginatedQueryOptions } from '../../commandUtils/pagination'; import fetch from '../../fetch'; import { @@ -249,6 +250,11 @@ export default class UpdatePublish extends EasCommand { projectDir, } = await getDynamicPublicProjectConfigAsync(); + assertEnvironmentFlagForSdk55OrGreater({ + sdkVersion: expPossiblyWithoutEasUpdateConfigured.sdkVersion, + environment, + }); + await maybeWarnAboutEasOutagesAsync(graphqlClient, [StatuspageServiceName.EasUpdate]); const easJsonAccessor = EasJsonAccessor.fromProjectPath(projectDir); diff --git a/packages/eas-cli/src/update/utils.ts b/packages/eas-cli/src/update/utils.ts index 98f804aab0..a2c6458bf0 100644 --- a/packages/eas-cli/src/update/utils.ts +++ b/packages/eas-cli/src/update/utils.ts @@ -1,7 +1,9 @@ import { ExpoConfig } from '@expo/config'; +import { Errors } from '@oclif/core'; import { format } from '@expo/timeago.js'; import chalk from 'chalk'; import dateFormat from 'dateformat'; +import semver from 'semver'; import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient'; import { @@ -357,3 +359,18 @@ export const updatePublishPlatformToAppPlatform: Record Date: Fri, 20 Feb 2026 13:22:32 -0800 Subject: [PATCH 2/4] CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f1e6fc391..573d1cf367 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ This is the log of notable changes to EAS CLI and related packages. ### 🛠 Breaking changes +- Require --environment flag for update commands when SDK >= 55. ([#3398](https://github.com/expo/eas-cli/pull/3398) by [@douglowder](https://github.com/douglowder)) + ### 🎉 New features ### 🐛 Bug fixes From 99be19c950d49701a51681b216faed3e57c8ccae Mon Sep 17 00:00:00 2001 From: Douglas Lowder Date: Fri, 20 Feb 2026 13:27:07 -0800 Subject: [PATCH 3/4] Do not check env flag if EAS_BUILD set --- packages/eas-cli/src/update/utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/eas-cli/src/update/utils.ts b/packages/eas-cli/src/update/utils.ts index a2c6458bf0..ea9ba41261 100644 --- a/packages/eas-cli/src/update/utils.ts +++ b/packages/eas-cli/src/update/utils.ts @@ -367,6 +367,9 @@ export function assertEnvironmentFlagForSdk55OrGreater({ sdkVersion: string | undefined; environment: string | undefined; }): void { + if (process.env.EAS_BUILD) { + return; + } if (sdkVersion && semver.gte(sdkVersion, '55.0.0') && !environment) { Errors.error( '--environment flag is required for projects using Expo SDK 55 or greater', From c1cb7de740b608f7d100e668e3a77cbd33e5696d Mon Sep 17 00:00:00 2001 From: Douglas Lowder Date: Fri, 20 Feb 2026 16:39:27 -0800 Subject: [PATCH 4/4] Fix lint --- packages/eas-cli/src/update/utils.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/eas-cli/src/update/utils.ts b/packages/eas-cli/src/update/utils.ts index ea9ba41261..cf66498eb8 100644 --- a/packages/eas-cli/src/update/utils.ts +++ b/packages/eas-cli/src/update/utils.ts @@ -371,9 +371,8 @@ export function assertEnvironmentFlagForSdk55OrGreater({ return; } if (sdkVersion && semver.gte(sdkVersion, '55.0.0') && !environment) { - Errors.error( - '--environment flag is required for projects using Expo SDK 55 or greater', - { exit: 1 } - ); + Errors.error('--environment flag is required for projects using Expo SDK 55 or greater', { + exit: 1, + }); } }