aws-amplify / aws-amplify/amplify-hosting
Creating a backend via the console and importing Auth from Cognito causes "auth headless is missing the following inputParams" when running "amplify pull"
- Dominant language
- Dockerfile
- Stars
- 481
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
### Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-console/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-console/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
### App Id
d3cbhlqhrq2d8
### Region
us-east-1
### Amplify Console feature
Backend builds
### Describe the bug
1. I logged into the AWS console and went to the AWS Amplify console.
2. I created a new backend and then opened up the Amplify Admin UI for that created backend.
3. I added Authentication by importing from Cognito. No errors came up during the import. I see the details (user pool id, web client id, native client id, etc.) correctly in the Admin UI.
4. When I try to pull down the app locally via the CLI, I get the following error --
```
✖ There was an error initializing your environment.
Failed to pull the backend.
auth headless is missing the following inputParams userPoolId, webClientId, nativeClientId
Error: auth headless is missing the following inputParams userPoolId, webClientId, nativeClientId
```
Full log from when I run the command --
```
➜ auth-with-totp-mfa git:(main) ✗ amplify pull --appId d3cbhlqhrq2d8 --envName staging --yes
Opening link: https://us-east-1.admin.amplifyapp.com/admin/d3cbhlqhrq2d8/staging/verify/
✔ Successfully received Amplify Admin tokens.
Amplify AppID found: d3cbhlqhrq2d8. Amplify App name is: auth-with-totp-mfa
Backend environment staging found in Amplify Console app: auth-with-totp-mfa
✔ Successfully pulled backend environment staging from the cloud.
✖ There was an error initializing your environment.
Failed to pull the backend.
auth headless is missing the following inputParams userPoolId, webClientId, nativeClientId
Error: auth headless is missing the following inputParams userPoolId, webClientId, nativeClientId
at ensureHeadlessParameters (/Users/keledwin/.nvm/versions/node/v14.16.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/src/provider-utils/awscloudformation/import/index.ts:1269:11)
at Object.headlessImport (/Users/keledwin/.nvm/versions/node/v14.16.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/src/provider-utils/awscloudformation/import/index.ts:1126:40)
at importedAuthEnvInit (/Users/keledwin/.nvm/versions/node/v14.16.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/src/provider-utils/awscloudformation/import/index.ts:903:18)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at updateConfigOnEnvInit (/Users/keledwin/.nvm/versions/node/v14.16.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/src/provider-utils/awscloudformation/index.js:50:72)
at /Users/keledwin/.nvm/versions/node/v14.16.1/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-auth/src/index.js:306:22
```
### Expected behavior
It should not produce an error. If everything looks correct and can be "built" inside the Admin UI without issue, then pulling it down should not produce an error at all.
### Reproduction steps
Reproduction steps mentioned in the bug description ^^
### Build Settings
_No response_
### Additional information
_No response_
Contributor guide
Research direction
Reproduce the console-created Cognito import and run the documented `amplify pull --appId d3cbhlqhrq2d8 --envName staging --yes` command. Start at `amplify-category-auth/src/provider-utils/awscloudformation/import/index.ts`, especially `ensureHeadlessParameters`, `headlessImport`, and `importedAuthEnvInit`, then verify that the imported userPoolId, webClientId, and nativeClientId are accepted and the pull completes without an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- authentication, cli, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100