Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthMode in Amplify Config is incorrect when using old Amplify config format (--config-version 0) #1547

Closed
Jordan-Nelson opened this issue May 22, 2024 · 2 comments · Fixed by #1579
Labels
amplify_outputs Issue related to generating amplify_outputs for deployed backends bug Something isn't working p2

Comments

@Jordan-Nelson
Copy link

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:

  1. 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
  2. Run npm create amplify@latest to create the backend
  3. Deploy the app in sandbox with the standard config. For Flutter: npx ampx sandbox --outputs-format dart --outputs-out-dir lib
  4. Observe lib/amplify_outputs.dart contains the following under "data" for auth modes. Observe that authorization_types contains "AMAZON_COGNITO_USER_POOLS"
"default_authorization_type": "AWS_IAM",
"authorization_types": [
  "AMAZON_COGNITO_USER_POOLS"
],
  1. Deploy the app in sandbox with the old config. For Flutter: npx ampx sandbox --outputs-format dart --outputs-out-dir lib --config-version 0
  2. Observe that lib/amplifyconfiguration.dart contains the following under "AppSync". Observe that data_AMAZON_COGNITO_USER_POOLS.AuthMode is "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.

@Jordan-Nelson Jordan-Nelson added the pending-triage Incoming issues that need categorization label May 22, 2024
@josefaidt
Copy link
Contributor

Hey @Jordan-Nelson 👋 thanks for raising this! marking as a bug

@josefaidt josefaidt added bug Something isn't working amplify_outputs Issue related to generating amplify_outputs for deployed backends and removed pending-triage Incoming issues that need categorization labels May 23, 2024
@ykethan ykethan added the p2 label May 28, 2024
@Amplifiyer
Copy link
Contributor

If I'm understanding this correctly, this is the change expected in the old config?

"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",
+ "AuthMode": "AMAZON_COGNITO_USER_POOLS",
  
  "ClientDatabasePrefix": "data_AMAZON_COGNITO_USER_POOLS"
}

Please confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
amplify_outputs Issue related to generating amplify_outputs for deployed backends bug Something isn't working p2
Projects
None yet
4 participants