aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
170 stars 58 forks source link

Take Into Account Special Characters when creating SSM parameters #831

Closed nadetastic closed 9 months ago

nadetastic commented 10 months ago

Environment information

System:
    OS: macOS 14.1.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 340.21 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    Yarn: Not Found
    npm: 10.2.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
    pnpm: 8.12.1 - /usr/local/bin/pnpm
    bun: Not Found
    Watchman: Not Found
  npmPackages:
    @aws-amplify/backend: ^0.6.0 => 0.6.0 
    @aws-amplify/backend-cli: ^0.9.2 => 0.9.2 
    aws-amplify: ^6.0.8 => 6.0.8 
    aws-cdk: Not Found
    aws-cdk-lib: Not Found
    typescript: ^5.3.3 => 5.3.3

Description

Currently if my package name happens to have a special character, sandbox fails with the error

ValidationException

The parameter doesn't meet the parameter name requirements ... It must use only letters, numbers, or the following symbols: . (period), - (hyphen), _ (underscore). Special characters are not allowed.

In the case you have a reason to name you package with @ (for example in a monorepo setup), the sandbox deploy fails as it seems to depend on using the package name to set the SSM params.

edwardfoyle commented 10 months ago

Looks like we need to do the same sanitization of project name for constructing parameter paths that we use for stack naming. Thanks for reporting, marking as a bug.