Description
Description
When running ampx sandbox
with the --identifier
flag, the custom identifier is displayed correctly during initial deployment. However, after the file watcher detects changes and triggers a rebuild, the identifier falls back to the default value (whoami username) in the console output.
Steps to Reproduce
-
Run sandbox with a custom identifier:
ampx sandbox --identifier my-custom-id
-
Observe that the initial deployment correctly shows:
[Sandbox] Identifier: my-custom-id
-
Make any change to a watched file (e.g., modify a backend file)
-
Observe that after the file change is detected, the console output reverts to showing the default identifier:
[Sandbox] Identifier: <your-username>
Expected Behavior
The custom identifier provided via the --identifier
flag should persist throughout the entire sandbox session, including after file changes trigger rebuilds.
Actual Behavior
The identifier falls back to the default (whoami) value after file changes are detected.
Root Cause
In /packages/sandbox/src/file_watching_sandbox.ts
, when the file watcher detects changes, it calls printSandboxNameInfo()
without passing the sandboxIdentifier
parameter (line 224). This causes the method to use the default identifier instead of the custom one provided by the user.
Environment
- amplify-backend version: latest
- Operating System: All
- Node.js version: All supported versions
Additional Context
This issue affects developer experience as it can cause confusion about which sandbox environment is being used, especially when working with multiple sandboxes using different identifiers.