Amplify sandbox bootstrap failing inside a VS Code dev container

0

I'm following the Amplify quickstart tutorial here: https://docs.amplify.aws/react-native/start/quickstart/

I've configured the local account for Amplify, per tutorial here: https://docs.amplify.aws/react-native/start/account-setup/#5-bootstrap-your-aws-account

But when i tried to start the sandbox. I got following errors.

node ➜ /workspaces/my_amplify_app (master) $ npx ampx sandbox --profile default --debug

ampx sandbox

Starts sandbox, watch mode for Amplify backend deployments

Commands:
  ampx sandbox delete            Deletes sandbox environment
  ampx sandbox secret <command>  Manage sandbox secrets

Options:
  --debug            Print debug logs to the console  [boolean] [default: false]
  --help             Show help                                         [boolean]
  --dir-to-watch     Directory to watch for file changes. All subdirectories and
                      files will be included. Defaults to the amplify directory.
                                                                        [string]
  --exclude          An array of paths or glob patterns to ignore. Paths can be
                     relative or absolute and can either be files or directories
                                                                         [array]
  --identifier       An optional identifier to distinguish between different san
                     dboxes. Default is the name of the system user executing th
                     e process                                          [string]
  --outputs-format   amplify_outputs file format
                  [string] [choices: "mjs", "json", "json-mobile", "ts", "dart"]
  --outputs-version  Version of the configuration. Version 0 represents classic
                     amplify-cli config file amplify-configuration and 1 represe
                     nts newer config file amplify_outputs
                                     [string] [choices: "0", "1"] [default: "1"]
  --outputs-out-dir  A path to directory where amplify_outputs is written. If no
                     t provided defaults to current process working directory.
                                                                        [string]
  --profile          An AWS profile name.                               [string]
  --once             Execute a single sandbox deployment without watching for fu
                     ture file changes                                 [boolean]

ParameterNotFound: UnknownError
[DEBUG] 2024-06-04T02:11:07.762Z: ParameterNotFound: UnknownError
    at de_ParameterNotFoundRes (/workspaces/my_amplify_app/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js:7923:21)
    at de_CommandError (/workspaces/my_amplify_app/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js:6758:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /workspaces/my_amplify_app/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
    at async /workspaces/my_amplify_app/node_modules/@smithy/core/dist-cjs/index.js:165:18
    at async /workspaces/my_amplify_app/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
    at async /workspaces/my_amplify_app/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:34:22
    at async FileWatchingSandbox.isBootstrapped (file:///workspaces/my_amplify_app/node_modules/@aws-amplify/sandbox/lib/file_watching_sandbox.js:233:46)
    at async FileWatchingSandbox.start (file:///workspaces/my_amplify_app/node_modules/@aws-amplify/sandbox/lib/file_watching_sandbox.js:85:30)
    at async Object.handler (file:///workspaces/my_amplify_app/node_modules/@aws-amplify/backend-cli/lib/commands/sandbox/sandbox_command.js:61:9)
ParameterNotFound: UnknownError
[DEBUG] 2024-06-04T02:11:07.764Z: ParameterNotFound: UnknownError
    at de_ParameterNotFoundRes (/workspaces/my_amplify_app/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js:7923:21)
    at de_CommandError (/workspaces/my_amplify_app/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js:6758:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /workspaces/my_amplify_app/node_modules/@smithy/middleware-serde/dist-cjs/index.js:35:20
    at async /workspaces/my_amplify_app/node_modules/@smithy/core/dist-cjs/index.js:165:18
    at async /workspaces/my_amplify_app/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
    at async /workspaces/my_amplify_app/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:34:22
    at async FileWatchingSandbox.isBootstrapped (file:///workspaces/my_amplify_app/node_modules/@aws-amplify/sandbox/lib/file_watching_sandbox.js:233:46)
    at async FileWatchingSandbox.start (file:///workspaces/my_amplify_app/node_modules/@aws-amplify/sandbox/lib/file_watching_sandbox.js:85:30)
    at async Object.handler (file:///workspaces/my_amplify_app/node_modules/@aws-amplify/backend-cli/lib/commands/sandbox/sandbox_command.js:61:9)
node ➜ /workspaces/my_amplify_app (master) $ 

Looking into the @aws-sdk/client-ssm or @smithy/middleware-serde @smithy/core code seems to point to something about http request handling. Any suggestions on how to troubleshoot? And anyone tried this from within a container?

Thanks!


Updates:

Looked into this further, the error was caused by this line in @aws-amplify/sandbox/lib/file_watching_sandbox.js:

            const { Parameter: parameter } = await this.ssmClient.send(new GetParameterCommand({
                Name: CDK_DEFAULT_BOOTSTRAP_VERSION_PARAMETER_NAME,
            }));

The hardcoded parameter name is also defined in that file:

export const CDK_DEFAULT_BOOTSTRAP_VERSION_PARAMETER_NAME =
// suppress spell checker, it is triggered by qualifier value.
// eslint-disable-next-line spellcheck/spell-checker
'/cdk-bootstrap/hnb659fds/version';

No idea why that particular parameter is missing. Any help is appreciated!

Felix
asked 17 days ago132 views
2 Answers
0
Accepted Answer

Fixed this by:

P.S. after this sandbox still didn't work with a seg fault. Found someone posted about it: https://github.com/aws-amplify/amplify-backend/issues/1297 Updating Node fixed it.

Felix
answered 16 days ago
0

Hello, do you have multiple local profiles or named your profile something other than default? If you only have default profile, please try to omit the parameter --profile. Thanks.

Zen
answered 17 days ago
  • I didn't setup any additional profile. And I started without any flag.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions