aws-amplify / aws-amplify/amplify-cli

Amplify CLI Authentication is not consistent, documentation does not clearly describe setup. Erratic!

Open
#12,936 10 comments 1 reaction 0 assignees View on GitHub
documentation duplicate feature-request platform
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

npm

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

20.3.1

### Amplify CLI Version

12.1.1

### What operating system are you using?

Windows 10

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

Sorry Unsure.
I would have setup Data Model in the Console???

### Describe the bug

**Summary:**
I am fully installed in VSCode and have been using Amplify for a couple of weeks now. (pushing and pulling on amplify and git)
I just did an 'amplify update auth'
I now wish to run 'amplify push' command from terminal.
I get this error (again like I did weeks ago):
```
Failed to get profile credentials
Cannot read properties of undefined (reading 'accessKeyId')
```
Please now head to the bottom for my terminal output...

**Background:**
For transparency, I am very new to AWS.
Amplify is designed for people like me "technical, but not familiar with detailed AWS services"
So the expectation is that the guides /tutorials just work.

Problem 1 - setting up IAM(SSO) Auth in Amplify-cli is an absolute nightmare, the docs need and overhaul. you may think the guide works but actually it is very confusing. I would be happy to sit down and demonstrate this to the owner of said docs.

Problem 2 - is the issue I am raising right now whereby Auth has been working fine since I got it working a couple of weeks ago.
now it spits out and error right at the end of an amplify push **just as it is about to finish**

Problem 3 - this experience has been the most frustrating experience of my 30 year IT career. sorry to be blunt but I have never had to deal with such documentation which takes the individual to the 90% mark and drops them off the cliff.

**Here is my Terminal Output:**
(simplified for readability):

```
> amplify push
| Building resource api/myapp✅ GraphQL schema compiled successfully.

Edit your schema at B:\workspace\AWS\org\git\my_app\amplify\backend\api\myapp\schema.graphql or place .graphql files in a directory at B:\workspace\AWS\org\git\my_app\amplify\backend\api\myapp\schema
√ Successfully pulled backend environment main from the cloud.

Current Environment: main

│ Category │ Resource name │ Operation │ Provider plugin │
│ Api │ AdminQueries │ Create │ awscloudformation │
│ Function │ AdminQueriesRaNdoMnEsS │ Create │ awscloudformation │
│ Function │ myappRaNdoMnEsSPostConfirmation │ Create │ awscloudformation │
│ Auth │ myappRaNdoMnEsS │ Update │ awscloudformation │
│ Function │ myappRaNdoMnEsSCreateAuthChallenge │ Delete │ awscloudformation │
│ Function │ myappRaNdoMnEsSDefineAuthChallenge │ Delete │ awscloudformation │
│ Function │ myappRaNdoMnEsSVerifyAuthChallengeResponse │ Delete │ awscloudformation │
│ Api │ myapp │ No Change │ awscloudformation │
│ Auth │ userPoolGroups │ No Change │ awscloudformation │
│ Function │ myappRaNdoMnEsSCustomMessage │ No Change │ awscloudformation │

√ Are you sure you want to continue? (Y/n) · yes

Deployment completed.
Deploying root stack myapp[ ====================================---- ] 8/9
amplify-myappweb-main-120003 AWS::CloudFormation::Stack UPDATE_COMPLETE_CLEANUP_IN_PR… Wed Jul 12 2023 19:38:16…
storagepubliccontent AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:37:52…
functionmyappRaNdoMnEsScCusto… AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:37:52…
functionmyappRaNdoMnEsSPostC… AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:37:52…
apimyapp AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:38:14…
authmyappRaNdoMnEsS AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:37:53…
functionAdminQueries5bbd3149 AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:37:55…
authuserPoolGroups AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:37:55…
apiAdminQueries AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:38:07…
Deployed api myapp [ ======================================== ] 12/12
Organisation AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:37:59…
Policy AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:38:03…
PolicyContent AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:38:02…
ConnectionStack AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:38:06…
CustomResourcesjson AWS::CloudFormation::Stack UPDATE_COMPLETE Wed Jul 12 2023 19:38:09…
Deployed api AdminQueries [ ======================================== ] 3/3
Deployed auth myappRaNdoMnEsS [ ======================================== ] 11/11
Deployed auth userPoolGroups [ ======================================== ] 10/10
Deployed function myappRaNdoMnEsSCustomMessage [ ======================================== ] 3/3
Deployed function AdminQueries5bbd3149 [ ======================================== ] 3/3
Deployed function myappRaNdoMnEsSPostConfirmation [ ======================================== ] 3/3

🛑 Failed to get profile credentials
Cannot read properties of undefined (reading 'accessKeyId')

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

Session Identifier: RaNdoMnEsS
```

### Expected behavior

It authenticates and finishes successfully!
like other processes I have run.

it is not disparate nor can it be random and sometimes work other times not.
nor is there a need for some many auth setups.

it should be simple and not so hard.

more documented explanation of how it works with a flow diagram of what files are utilised during this process.

### Reproduction steps

Add Google Recaptcha to Auth.
amplify Push
publish it fails due to Google Recaptcha
remove Google Recaptcha
amplify Push
Auth error.

really not sure what is causing it so no idea what the steps are.

### Project Identifier

_No response_

### Log output

OK I think I found the issue here in the logs, so I continue to log it so someone can address to craziness because this is not in the docs and it also seems to be buggy and disparate technically

Here is the line in my log output that helped: **in bold is the culprit**:

2023-07-12T08:03:00.325Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(**["AmplifyAdminAccess-012343456789"**])

further info below...

### Additional information

the Auth Screen on the AWS front door
give me this:
[012343456789_AmplifyAdminAccess]
aws_access_key_id=qwertyasdfgh
aws_secret_access_key=blahdeeblahdebladeeblah
aws_session_token=dytbb5uube//////////wEblahdeeblahdebladeeblahDczMzI1IgblahdeeblahdebladeeblahAIIR...

AmplifyAdminAccess-012343456789 in the logs is completely formatted incorrect and not what is in my config file, nor what is given to me from the AWS START page.

This problem stems from the bad documentation that sent me down many rabbit holes, and may have cause me to write a file wrong at some point, but in any case why have I been able to login and now not :( and why are these 2 formats existing the format of profile names should be a locked in syntax.
and made no mention of a profile name in another config file...
local-aws-ingo.json:
{
"dev": {
"configLevel": "project",
"useProfile": true,
"profileName": "some_other_random_profile_name"
},
"main": {
"configLevel": "project",
"useProfile": true,
"profileName": "AmplifyAdminAccess-012343456789"
}
}

it cannot find:
AmplifyAdminAccess-012343456789
because my config is the opposite way around and has an underscore????

**OK updating the local-aws-ingo.json: with the profile name from the auth screen worked.
But something needs to be done to make this easy.
Thank you log files!**

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