amplify-backend
amplify-backend copied to clipboard
AuthMode in Amplify Config is incorrect when using old Amplify config format (`--config-version 0`)
Environment information
System:
OS: macOS 13.6.6
CPU: (10) arm64 Apple M1 Pro
Memory: 175.64 MB / 32.00 GB
Shell: /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.16.0/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
pnpm: 8.6.11 - ~/Library/pnpm/pnpm
NPM Packages:
@aws-amplify/backend: 1.0.2
@aws-amplify/backend-cli: 1.0.3
aws-amplify: 6.3.2
aws-cdk: 2.142.1
aws-cdk-lib: 2.142.1
typescript: 5.4.5
AWS environment variables:
AWS_STS_REGIONAL_ENDPOINTS = regional
AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables
Description
Steps to reproduce:
- Create new app. In my case I am using a Flutter app (
flutter create my_amplify_app) but I think this is likely reproducible on all platforms - Run
npm create amplify@latestto create the backend - Deploy the app in sandbox with the standard config. For Flutter:
npx ampx sandbox --outputs-format dart --outputs-out-dir lib - Observe
lib/amplify_outputs.dartcontains the following under "data" for auth modes. Observe thatauthorization_typescontains "AMAZON_COGNITO_USER_POOLS"
"default_authorization_type": "AWS_IAM",
"authorization_types": [
"AMAZON_COGNITO_USER_POOLS"
],
- Deploy the app in sandbox with the old config. For Flutter:
npx ampx sandbox --outputs-format dart --outputs-out-dir lib --config-version 0 - Observe that
lib/amplifyconfiguration.dartcontains the following under "AppSync". Observe thatdata_AMAZON_COGNITO_USER_POOLS.AuthModeis "AWS_IAM". "AMAZON_COGNITO_USER_POOLS" is not listed as an auth mode.
"Default": {
"ApiUrl": "https://<id>.appsync-api.us-east-1.amazonaws.com/graphql",
"Region": "us-east-1",
"AuthMode": "AWS_IAM",
"ClientDatabasePrefix": "data_AWS_IAM"
},
"data_AMAZON_COGNITO_USER_POOLS": {
"ApiUrl": "https://<id>.appsync-api.us-east-1.amazonaws.com/graphql",
"Region": "us-east-1",
"AuthMode": "AWS_IAM",
"ClientDatabasePrefix": "data_AMAZON_COGNITO_USER_POOLS"
}
Expected behavior: Both config formats should contain an auth mode of "AMAZON_COGNITO_USER_POOLS".
Actual behavior: "AMAZON_COGNITO_USER_POOLS" is only listed as an auth mode when using the new config.