From 3a3fa02889332af204610347270701c4ef5d3a93 Mon Sep 17 00:00:00 2001 From: Alex Lau Date: Sun, 29 Jun 2025 15:48:14 +0800 Subject: [PATCH] fix: maintain custom sandbox identifier after file changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running sandbox with --identifier flag, the custom identifier now persists throughout the entire session, including after file changes trigger rebuilds. Previously, the identifier would fall back to default (whoami) after file changes because printSandboxNameInfo() was called without passing the sandboxIdentifier parameter. Fixes #2874 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .changeset/fix-sandbox-identifier-persistence.md | 7 +++++++ packages/sandbox/src/file_watching_sandbox.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/fix-sandbox-identifier-persistence.md diff --git a/.changeset/fix-sandbox-identifier-persistence.md b/.changeset/fix-sandbox-identifier-persistence.md new file mode 100644 index 00000000000..5efc9840116 --- /dev/null +++ b/.changeset/fix-sandbox-identifier-persistence.md @@ -0,0 +1,7 @@ +--- +'@aws-amplify/sandbox': patch +--- + +fix: maintain custom sandbox identifier after file changes + +The sandbox identifier provided via --identifier flag now persists throughout the entire session, including after file changes trigger rebuilds. Previously, the identifier would fall back to the default (whoami) value after file changes. diff --git a/packages/sandbox/src/file_watching_sandbox.ts b/packages/sandbox/src/file_watching_sandbox.ts index f5076416dfe..455ce275b16 100644 --- a/packages/sandbox/src/file_watching_sandbox.ts +++ b/packages/sandbox/src/file_watching_sandbox.ts @@ -221,7 +221,7 @@ export class FileWatchingSandbox extends EventEmitter implements Sandbox { this.filesChangesTracker.trackFileChange(filePath); if (latch === 'open') { this.printer.clearConsole(); - await this.printSandboxNameInfo(); + await this.printSandboxNameInfo(options.identifier); } this.printer.log( `[Sandbox] Triggered due to a file ${eventName} event: ${path.relative(