Skip to content

Commit 060bfdb

Browse files
authored
Updates bootstrap message with more info (#2435)
* update bootstrap message to show region and additional info
1 parent 521bbb0 commit 060bfdb

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

.changeset/seven-hounds-speak.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/sandbox': patch
3+
---
4+
5+
updates bootstrap message

packages/sandbox/src/file_watching_sandbox.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
SSMClient,
3737
SSMServiceException,
3838
} from '@aws-sdk/client-ssm';
39+
import { EOL } from 'os';
3940

4041
// Watcher mocks
4142
const unsubscribeMockFn = mock.fn();
@@ -190,7 +191,11 @@ void describe('Sandbox to check if region is bootstrapped', () => {
190191
assert.strictEqual(printer.log.mock.callCount(), 1);
191192
assert.strictEqual(
192193
printer.log.mock.calls[0].arguments[0],
193-
'The given region has not been bootstrapped. Sign in to console as a Root user or Admin to complete the bootstrap process, then restart the sandbox.'
194+
`The region ${format.highlight(
195+
region
196+
)} has not been bootstrapped. Sign in to the AWS console as a Root user or Admin to complete the bootstrap process, then restart the sandbox.${EOL}If this is not the region you are expecting to bootstrap, check for any AWS environment variables that may be set in your shell or use ${format.command(
197+
'--profile <profile-name>'
198+
)} to specify a profile with the correct region.`
194199
);
195200
assert.strictEqual(printer.log.mock.calls[0].arguments[1], undefined);
196201
});
@@ -221,7 +226,11 @@ void describe('Sandbox to check if region is bootstrapped', () => {
221226
assert.strictEqual(printer.log.mock.callCount(), 3);
222227
assert.strictEqual(
223228
printer.log.mock.calls[0].arguments[0],
224-
'The given region has not been bootstrapped. Sign in to console as a Root user or Admin to complete the bootstrap process, then restart the sandbox.'
229+
`The region ${format.highlight(
230+
region
231+
)} has not been bootstrapped. Sign in to the AWS console as a Root user or Admin to complete the bootstrap process, then restart the sandbox.${EOL}If this is not the region you are expecting to bootstrap, check for any AWS environment variables that may be set in your shell or use ${format.command(
232+
'--profile <profile-name>'
233+
)} to specify a profile with the correct region.`
225234
);
226235
assert.strictEqual(printer.log.mock.calls[0].arguments[1], undefined);
227236
assert.strictEqual(

packages/sandbox/src/file_watching_sandbox.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
BackendIdentifierConversions,
3838
} from '@aws-amplify/platform-core';
3939
import { LambdaFunctionLogStreamer } from './lambda_function_log_streamer.js';
40+
import { EOL } from 'os';
4041

4142
/**
4243
* CDK stores bootstrap version in parameter store. Example parameter name looks like /cdk-bootstrap/<qualifier>/version.
@@ -120,12 +121,16 @@ export class FileWatchingSandbox extends EventEmitter implements Sandbox {
120121

121122
this.filesChangesTracker = await createFilesChangesTracker(watchDir);
122123
const bootstrapped = await this.isBootstrapped();
124+
// get region from an available sdk client;
125+
const region = await this.ssmClient.config.region();
123126
if (!bootstrapped) {
124127
this.printer.log(
125-
'The given region has not been bootstrapped. Sign in to console as a Root user or Admin to complete the bootstrap process, then restart the sandbox.'
128+
`The region ${format.highlight(
129+
region
130+
)} has not been bootstrapped. Sign in to the AWS console as a Root user or Admin to complete the bootstrap process, then restart the sandbox.${EOL}If this is not the region you are expecting to bootstrap, check for any AWS environment variables that may be set in your shell or use ${format.command(
131+
'--profile <profile-name>'
132+
)} to specify a profile with the correct region.`
126133
);
127-
// get region from an available sdk client;
128-
const region = await this.ssmClient.config.region();
129134
const bootstrapUrl = getBootstrapUrl(region);
130135
try {
131136
await this.open(bootstrapUrl);

0 commit comments

Comments
 (0)