aws-amplify / aws-amplify/amplify-cli

`amplify remove auth` to remove userPoolGroups after failed `amplify add auth` results in unexpected error and stack trace

Open
#12,433 1 comment 1 reaction 0 assignees View on GitHub
auth bug ops-errors p4
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

pnpm

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

18

### Amplify CLI Version

11.0.4

### 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.

n/a

### Describe the bug

Receiving `TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined` when attempting to remove a stray `userPoolGroups` resource after exiting from `amplify add auth`. The resource was removed successfully, and then errors

```
Documents/projects/amplify-templinks
➜ amplify add auth
Using service: Cognito, provided by: awscloudformation

The current configured provider is Amazon Cognito.

Do you want to use the default authentication and security configuration? Manual configur
ation
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 othe
r content, Analytics, and more)
Provide a friendly name for your resource that will be used to label this category in the
project: amplifytemplinksauth
Enter a name for your identity pool. amplifytemplinksauth_identitypool
Allow unauthenticated logins? (Provides scoped down permissions that you can control via
AWS IAM) Yes
Do you want to enable 3rd party authentication providers in your identity pool? No
Provide a name for your user pool: amplifytemplinksauth_userpool
Warning: you will not be able to edit these selections.
How do you want users to be able to sign in? Email
Do you want to add User Pool Groups? Yes
? Provide a name for your user pool group: users
? Do you want to add another User Pool Group 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, users
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? Email Verification Link with Red
irect, Add User to Group
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 Custom Message, Post Confirmation
? What functionality do you want to use for Custom Message Send Account Confirmation Link
w/ Redirect
? What functionality do you want to use for Post Confirmation Add User To Group
✔ Enter the URL that your users will be redirected to upon account confirmation: · http://localhost:3000/

✖ Enter the subject for your custom account confirmation email: ·
undefined
🛑 There was an error adding the auth resource

Documents/projects/amplify-templinks
➜ amplify add auth
⚠️ Auth has already been added to this project. To update run amplify update auth.

Documents/projects/amplify-templinks
➜ amplify remove auth
? Choose the resource you would want to remove userPoolGroups

? Are you sure you want to delete the resource? This action deletes all files related to t
his resource from the backend directory. Yes
✅ Successfully removed resource
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (internal/errors.js:322:7)
at validateString (internal/validators.js:124:11)
at Object.join (path.js:1148:7)
at new AuthInputState (/snapshot/repo/build/node_modules/@aws-amplify/amplify-category-auth/lib/provider-utils/awscloudformation/auth-inputs-manager/auth-input-state.js:59:91)
at Object.run (/snapshot/repo/build/node_modules/@aws-amplify/amplify-category-auth/lib/commands/auth/remove.js:23:30)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.executeAmplifyCommand (/snapshot/repo/build/node_modules/@aws-amplify/amplify-category-auth/lib/index.js:345:5)
at async executePluginModuleCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:135:5)
at async executeCommand (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/execution-manager.js:33:9)
at async Object.run (/snapshot/repo/build/node_modules/@aws-amplify/cli-internal/lib/index.js:117:5)
🛑 There was an error removing the auth resource
```

### Expected behavior

operation completes successfully and exits

### Reproduction steps

1. `amplify init -y`
2. `amplify add auth` > manual > add user pool groups
3. ctrl+c from `add auth` flow after adding user pool groups
4. `amplify remove auth` to remove `userPoolGroups` resource
5. observe successful and error

### Project Identifier

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

### Before submitting, please confirm:

- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.