amplify-backend
amplify-backend copied to clipboard
fix: maintain custom sandbox identifier after file changes
Summary
This PR fixes an issue where the sandbox identifier falls back to the default value (whoami) after file changes are detected by the file watcher.
- Ensures custom identifier provided via
--identifierflag persists throughout the entire sandbox session - Passes the
sandboxIdentifierparameter toprintSandboxNameInfo()when called from the file watcher
Issue
Fixes #2874
Description of Changes
In packages/sandbox/src/file_watching_sandbox.ts, the file watcher was calling printSandboxNameInfo() without passing the sandboxIdentifier parameter. This caused the method to fall back to using the default identifier (whoami) instead of the custom one provided by the user.
The fix is simple: pass options.identifier to the method call on line 224.
Test Plan
Manual Testing
- Run sandbox with a custom identifier:
ampx sandbox --identifier my-custom-id - Verify that the initial deployment shows the custom identifier
- Make a change to any watched file
- Verify that after the file change is detected, the console still shows the custom identifier
Expected Behavior
- Before fix: Identifier reverts to default (username) after file changes
- After fix: Identifier remains as the custom value throughout the session
Verification
- ✅ All unit tests passed (56 tests in sandbox package)
- ✅ Linting passed (
npm run lint) - ✅ Build successful (
npm run build) - ✅ Added changeset for version management
Checklist
- [x] Unit tests passed
- [x] Integration tests passed
- [x] Manual testing completed
- [x] No breaking changes
🤖 Generated with Claude Code