amplify-cli: Cannot read property 'accessKeyId' of undefined, after latest update
Before opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
17.7.1
Amplify CLI Version
8.1.0
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
Amplify Categories
auth, api
Amplify Commands
pull, push, status
Describe the bug
After running
aws-vault exec foo
When performing an amplify command, error
Failed to get profile: Cannot read property 'accessKeyId' of undefined
presents itself.
If I remove aws-vault, and create a credentials file in my ~/.aws folder and add the credentials there, I get a different error:
Name: ResourceNotFoundException : Message: User pool **-******-******** does not exist.
Expected behavior
The command(s) should work
Reproduction steps
Using AWS-VAULT
- aws-vault exec foo All commands there after present error
GraphQL schema(s)
# Put schemas below this line
Log output
# Put your logs below this line
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 53 (13 by maintainers)
Hey @adcanis based on the error for “Cognito does not exist” it appears the Amplify CLI is successfully authenticating however is not able to find the resource in the specified account and region. If this is an existing project you have locally, is it possible the
amplify/.config/local-aws-info.jsonfile is pointing to a unintended profile for this environment?ok - I’m using an SSO profile to deploy. I run
amplify initusing a named profileappdeploy. No matter whether I call the --profile flag when I runamplify initand selectappdeployas the aws profile or not…it believes the access_key_id is “undefined”. However, when I change the name of that profile to default…all of a sudden it works.There is clearly an bug for (at least)
amplify initwhereby under certain conditions, it won’t recognize any profile other than default.Hey @vkanagarajan glad to hear you’re back up and running, and thanks @m98 for chiming in here! I’m glad to hear you’ve found value out of this thread!
Given the issue is now resolved I will close this for now, however if this issue reappears please reply back to this thread and we can re-open to investigate further 🙂
Hi guyz, I melt 3hours for this fucking problem:
And finally resolved it as below procedure with my profile set in
~/.aws/credentials:Hey @vkanagarajan I was able to reproduce this if I point my profileName in
amplify/.config/local-aws-info.jsonto a profile name that does not exist on my machine:Can you confirm the profile
defaultexists within your AWS configuration at~/.aws/credentials?In the end, I had to completely get rid of my app’s backend in the AWS UI console, and start again from scratch with a brand new backend as I was losing far too much time over this. No idea what went wrong or how it got so badly out of sync.
Can confirm that deleting the
amplifydirectory and then runningamplify pull --appId ******** --envName ***to grab my backend files again fixed the issue for me with no weird side-effects. I didn’t need to delete myaws-exports.js.@josefaidt @m98 Just wanted to say thanks for all the help. The resolution seems to be to remove the
amplifydirectory andaws-exports.jsfile as @m98 mentioned. In my case I did not init, but rather pulled the existing project in.I ran
amplify initthen enter the credentials (previously I created that credential by runningamplify configure)