aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.83k stars 825 forks source link

Pre sign up function template bug #10944

Closed ptero closed 2 years ago

ptero commented 2 years ago

Before opening, please confirm:

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v18.8.0

Amplify CLI Version

9.2.1

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Amplify Categories

auth

Amplify Commands

update

Describe the bug

If you add a a pre sign-up Lamda function with a blank template, it leaves placeholder DOMAINALLOWLIST and DOMAINDENYLIST strings in the team-provider-info.json. This causes the cloud formation to fail, because it doesn't depend on those parameters.

Expected behavior

DOMAINALLOWLIST and DOMAINDENYLIST shouldn't be added to team-provider-info.json for blank pre sign-up Lamda functions.

Reproduction steps

  1. amplify update auth
  2. add cognito trigger
  3. pre sign-up
  4. blank template
  5. amplify push

GraphQL schema(s)

```graphql # Put schemas below this line ```

Project Identifier

13b01e21d74a4191a9005d3fb288768f

Log output

``` CREATE_FAILED functionhubAuthPreSignup AWS::CloudFormation::Stack Sat Aug 27 2022 09:53:15 GMT+0100 (British Summer Time) Parameters: [DOMAINALLOWLIST, DOMAINDENYLIST] do not exist in the template ```

Additional information

No response

josefaidt commented 2 years ago

Hey @ptero :wave: thanks for raising this! Unfortunately I was not able to reproduce this issue using Amplify CLI 9.2.1 and the following auth configuration in a new project:

 Do you want to use the default authentication and security configuration? Manual configuration
 Select the authentication/authorization services that you want to use: User Sign-Up, Sign-In, connected with 
AWS IAM controls (Enables per-user Storage features for images or other content, Analytics, and more)
 Provide a friendly name for your resource that will be used to label this category in the project: 1094447348
39647348396
 Enter a name for your identity pool. 1094447348396_identitypool_47348396
 Allow unauthenticated logins? (Provides scoped down permissions that you can control via AWS IAM) No
 Do you want to enable 3rd party authentication providers in your identity pool? No
 Provide a name for your user pool: 1094447348396_userpool_47348396
 Warning: you will not be able to edit these selections. 
 How do you want users to be able to sign in? Username
 Do you want to add User Pool Groups? Yes
? Provide a name for your user pool group: admins
? Do you want to add another User Pool Group No
✔ Sort the user pool groups in order of preference · admins
 Do you want to add an admin queries API? No
 Multifactor authentication (MFA) user login options: OFF
 Email based user registration/forgot password: Enabled (Requires per-user email entry at registration)
 Specify an email verification subject: Your verification code
 Specify an email verification message: Your verification code is {####}
 Do you want to override the default password policy for this User Pool? No
 Warning: you will not be able to edit these selections. 
 What attributes are required for signing up? Email
 Specify the app's refresh token expiration period (in days): 30
 Do you want to specify the user attributes this app can read and write? No
 Do you want to enable any of the following capabilities? 
 Do you want to use an OAuth flow? No
? Do you want to configure Lambda Triggers for Cognito? Yes
? Which triggers do you want to enable for Cognito Pre Sign-up
? What functionality do you want to use for Pre Sign-up Create your own module
Successfully added resource 109444734839647348396PreSignup locally.

I'd like to specifically callout the create your own module selection:

? Do you want to configure Lambda Triggers for Cognito? Yes
? Which triggers do you want to enable for Cognito Pre Sign-up
? What functionality do you want to use for Pre Sign-up Create your own module

Were there selections made that differ from the selection set above?