"No credentials found for appId" - Can't checkout existing amplify env using "amplify env checkout"
Describe the bug
For some reason amplify env checkout is not working anymore (for any env). I'm getting the following message:
amplify env checkout main
⠋ Initializing your environment: main
No credentials found for appId: xxxxxx
If the appId is correct, try running amplify configure --appId xxxxxx
Running amplify configure --appId xxxxxx doesn't solve the issue. It helps in creating another set of IAM credentials but when done I'm still getting the same errors.
To Reproduce
Not sure how to reproduce...
Expected behavior
I expect to git checkout main and then amplify env checkout main and to be able to work on the main BE env.
What is Configured?
team-provider-info.json
"main": {
"awscloudformation": {
"AuthRoleName": "amplify-xxxxxxx-main-xxxxxxx-authRole",
"UnauthRoleArn": "arn:aws:iam::xxxxxxx:role/amplify-xxxxxxx-main-xxxxxxx-unauthRole",
"AuthRoleArn": "arn:aws:iam::xxxxxxx:role/amplify-xxxxxxx-main-xxxxxxx-authRole",
"Region": "us-east-1",
"DeploymentBucketName": "amplify-xxxxxxx-main-xxxxxxx-deployment",
"UnauthRoleName": "amplify-xxxxxxx-main-xxxxxxx-unauthRole",
"StackName": "amplify-xxxxxxx-main-xxxxxxx",
"StackId": "arn:aws:cloudformation:us-east-1:xxxxxxx:stack/amplify-xxxxxxx-main-xxxxxxx/xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx",
"AmplifyAppId": "xxxxxxx"
},
"categories": {
"function": {
"platformauthCustomMessage": {
"REDIRECTURL": "https://xxxxxxx.xxxxxx.skyline.ai",
"EMAILSUBJECT": "Confirm your email address",
"EMAILMESSAGE": "",
"RESOURCENAME": "platformauth"
},
"AdminQueriescxxxxxxx": {}
},
"auth": {
"platformauth": {},
"userPoolGroups": {}
}
}
}
aws-exports.js
const awsmobile = {
"aws_project_region": "us-east-1",
"aws_cognito_identity_pool_id": "us-east-1:xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"aws_cognito_region": "us-east-1",
"aws_user_pools_id": "us-east-1_xxxxxxx",
"aws_user_pools_web_client_id": "xxxxxxxxxxxxxxxxxxxx",
"oauth": {},
"aws_cloud_logic_custom": [
{
"name": "AdminQueries",
"endpoint": "https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/xxxxxxx",
"region": "us-east-1"
}
],
"aws_appsync_graphqlEndpoint": "https://xxxxxxxxxxx.appsync-api.us-east-1.amazonaws.com/graphql",
"aws_appsync_region": "us-east-1",
"aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS"
};
BTW, comparing with my Cloudformation stack, I can confirm that all the data in my team-provider-info.json is correct
Apparently, this is returning false:
export function doAdminCredentialsExist(appId: string): boolean {
if (!appId) {
throw `Failed to check if admin credentials exist: appId is undefined`;
}
return !!stateManager.getAmplifyAdminConfigEntry(appId);
}
Trying to figure out why
I have also the same error :(
Okay. I think the culprit was upgrading my CLI + enabling the new "Admin UI". Not sure what the old version was but the current one is 4.37.1. Anyway, after deleting main in the local team-provider-info.json and pulling main BE env the issue was resolved and I was redirected to the new admin UI for authentication.
amplify pull --appId xxxxxx --envName main
Opening link: https://us-east-1.admin.amplifyapp.com/admin/xxxxxx/main/verify/
I'm running into the same issue with amplify CLI version 4.38.2, setting up the the new Admin UI could have also caused this.
Attempting amplify pull --appId xxxxxx --envName main doesn't work for me, i get the following permissions error
EPERM: operation not permitted, rename 'C:\Work\Franchise-Manager\amplify' -> 'C:\Work\Franchise-Manager\amplify-backup'
Error: EPERM: operation not permitted, rename 'C:\Work\Franchise-Manager\amplify' -> 'C:\Work\Franchise-Manager\amplify-backup'
at Object.renameSync (fs.js:741:3)
at rename (C:\Users\jspen\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\fs-extra\lib\move-sync\move-sync.js:31:8)
at doRename (C:\Users\jspen\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\fs-extra\lib\move-sync\move-sync.js:26:10)
at Object.moveSync (C:\Users\jspen\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\fs-extra\lib\move-sync\move-sync.js:17:10)
at backupAmplifyFolder (C:\Users\jspen\AppData\Roaming\npm\node_modules\@aws-amplify\cli\lib\attach-backend.js:107:12)
at Object.attachBackend (C:\Users\jspen\AppData\Roaming\npm\node_modules\@aws-amplify\cli\lib\attach-backend.js:35:5)
at Object.exports.run (C:\Users\jspen\AppData\Roaming\npm\node_modules\@aws-amplify\cli\lib\commands\pull.js:62:32)
at Object.executeAmplifyCommand (C:\Users\jspen\AppData\Roaming\npm\node_modules\@aws-amplify\cli\lib\index.js:182:29)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async executePluginModuleCommand (C:\Users\jspen\AppData\Roaming\npm\node_modules\@aws-amplify\cli\lib\execution-manager.js:153:5)
Reverting to @aws-amplify/cli version 4.37.1 gets around this and i'm able to checkout my environment and pull, however when i try to push i get these errors instead:
Could not read cloudformation template at path: C:\Work\Franchise-Manager\amplify\backend\api\franchisemanager\build\cloudformation-template.json
UPDATE_FAILED apifranchisemanager AWS::CloudFormation::Stack Wed Dec 09 2020 13:18:54 GMT+0000 (Greenwich Mean Time) Parameters: [unauthRoleName, authRoleName] do not exist in the template
The cloudformation template for the api doesn't exist at all, looks like it could be related to issue #6097
The missing unauthRoleName, authRoleName params issue may have been fixed in the later versions of the cli with #4814 but it seems people are still running into it looking at #2519. I'm not able to test if the latest version fixes this because the new version is broken in different ways and I can't get to that stage.
When i try the suggest fix of manually updating my parameters.json to get around this, the error message changes to Unexpected token u in JSON at position 0
An error occurred during the push operation: Unexpected token u in JSON at position 0
I'm also getting this issue. I'm helping a client with a tight deadline and it's a blocker since I can't create new environments for them. I just don't have time today to debug this one with the source code :sweat:
Same issue for me as well. I've tried changing my amplify cli to 4.37.1 but I still have this issue
In case anyone this helps anyone, my temporary workaround has been re-cloning the project and running amplify pull into a new amplify environment. It seems slightly easier than battling with the CLI each env change.
So for anyone else for whom this is still an issue, the following seemed to work for me after updating to 4.40.0
the amplify/.config/local-aws-info.json file had the following for my environment:
{
"dev": {
"configLevel": "amplifyAdmin"
}
}
After I replaced it with the following, amplify commands worked without any problem
{
"dev": {
"configLevel": "project",
"useProfile": true,
"profileName": "default"
}
}
@the-camputer thank you so much! this was my issue as well, popping up after upgrading to amplify cli 4.40.0.
working on windows and amplify inside wsl2 linux, the amplify admin ui auth procedure simply doesn't seem to work for me, but setting my aws profile like you specified did the trick. i also noticed that my env features a third option, which simply links to a randomly named text file, that has my iam credentials plus region inside (don't know how/when this was set up, are there any docs?):
{
"dev": {
"configLevel": "project",
"useProfile": false,
"awsConfigFilePath": "/home/someuser/.amplify/awscloudformation/sUv2gvDk4U"
},
"prod": {
"configLevel": "project",
"useProfile": true,
"profileName": "awsprofilename"
}
}
contents of the aws config file mentioned in the dev section:
{
"accessKeyId": "...",
"secretAccessKey": "...",
"region": "eu-central-1"
}
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.