aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.82k stars 821 forks source link

Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 #11694

Closed maq796113 closed 1 year ago

maq796113 commented 1 year ago

How did you install the Amplify CLI?

curl

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

No response

Amplify CLI Version

10.5.2

What operating system are you using?

Windows

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

I really did nothing I was just setting up Amplify for using it to upload some files to my s3 Bucket from the Android Mobile App.

Describe the bug

So basically the title says it all, "Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1" image

Expected behavior

I was expecting the command I typed to put the required files in the deployment bucket.

Reproduction steps

I typed the following command after configuring Amplify with the command amplify configure:

amplify init

Project Identifier

9238984c8987c8a8b06cc18733f7beff

Log output

``` # Put your logs below this line 2023-01-03T19:15:16.025Z|info : amplify status core {"yes":false} 2023-01-03T19:15:16.097Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({} 2023-01-03T19:15:20.254Z|error : File at path: 'D:\80gb_2\Private\Desktop\University_Work\Senior_Year_Project\QuranTutor1218\QuranTutor\QuranTutor\amplify\#current-cloud-backend\amplify-meta.json' does not exist UnknownFault: File at path: 'D:\80gb_2\Private\Desktop\University_Work\Senior_Year_Project\QuranTutor1218\QuranTutor\QuranTutor\amplify\#current-cloud-backend\amplify-meta.json' does not exist 2023-01-03T19:22:51.769Z|info : amplify env core 2023-01-03T19:23:01.989Z|info : amplify env core list 2023-01-03T19:23:02.120Z|error : Current environment cannot be determined. EnvironmentNotInitializedError: Current environment cannot be determined. 2023-01-03T19:23:41.393Z|info : amplify env core list 2023-01-03T19:23:41.541Z|error : Current environment cannot be determined. EnvironmentNotInitializedError: Current environment cannot be determined. 2023-01-03T19:46:39.558Z|info : amplify env core 2023-01-03T19:47:02.569Z|info : amplify env core get {"name":"[***]an","yes":false} 2023-01-03T19:48:39.767Z|info : amplify pull core {"appId":"[***]y3xqfc","envName":"[***]an","yes":false} 2023-01-03T19:48:39.819Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({} 2023-01-03T19:48:41.181Z|error : Backup folder at D:\80gb_2\Private\Desktop\University_Work\Senior_Year_Project\QuranTutor1218\QuranTutor\QuranTutor\amplify-backup already exists, remove the folder and retry the operation. DirectoryAlreadyExistsError: Backup folder at D:\80gb_2\Private\Desktop\University_Work\Senior_Year_Project\QuranTutor1218\QuranTutor\QuranTutor\amplify-backup already exists, remove the folder and retry the operation. 2023-01-03T19:50:33.517Z|info : amplify init core 2023-01-03T19:50:33.575Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({} 2023-01-03T19:51:23.319Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileRegion(["default"]) 2023-01-03T19:51:23.323Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["default"]) 2023-01-03T19:51:23.345Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileRegion(["default"]) 2023-01-03T19:51:23.346Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["default"]) 2023-01-03T19:51:23.358Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null]) 2023-01-03T19:51:23.362Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]utor-[***]an-[***]404-[***]ment"}]) 2023-01-03T19:51:32.011Z|error : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null]) CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 2023-01-03T19:51:34.376Z|error : Could not initialize platform for 'quran': Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 ProjectInitFault: Could not initialize platform for 'quran': Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 2023-01-03T19:52:52.256Z|info : amplify help core 2023-01-03T20:01:37.201Z|info : amplify init core 2023-01-03T20:01:37.265Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({} 2023-01-03T20:01:48.221Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null]) 2023-01-03T20:01:48.224Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]utor-[***]an-[***]404-[***]ment"}]) 2023-01-03T20:01:49.394Z|error : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null]) NoSuchKey: The specified key does not exist. 2023-01-03T20:01:51.731Z|error : Could not initialize platform for 'quran': The specified key does not exist. ProjectInitFault: Could not initialize platform for 'quran': The specified key does not exist. 2023-01-03T20:02:02.455Z|info : amplify env core list 2023-01-03T20:05:20.592Z|info : amplify env core 2023-01-03T20:05:36.018Z|info : amplify env core add 2023-01-03T20:06:21.365Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileRegion(["default"]) 2023-01-03T20:06:21.366Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["default"]) 2023-01-03T20:06:21.376Z|info : amplify-provider-awscloudformation.amplify-service-permission-check.checkAmplifyServiceIAMPermission.amplifyClient.listApps([]) 2023-01-03T20:06:22.595Z|info : amplify-provider-awscloudformation.amplify-service-manager.init.amplifyClient.listApps([{"maxResults":25}]) 2023-01-03T20:06:23.424Z|info : amplify-provider-awscloudformation.amplify-service-manager.init.amplifyClient.getBackendEnvironment([{"appId":"[***]y3xqfc","environmentName":"[***]or"}]) 2023-01-03T20:06:24.214Z|error : amplify-provider-awscloudformation.amplify-service-manager.init.amplifyClient.getBackendEnvironment([{"appId":"[***]y3xqfc","environmentName":"[***]or"}]) NotFoundException: BackendEnvironment tutor does not exist. 2023-01-03T20:06:24.215Z|info : amplify-provider-awscloudformation.amplify-service-manager.init.amplifyClient.getBackendEnvironment([{"appId":"[***]y3xqfc","environmentName":"[***]or","stackName":"[***]ify-[***]utor-[***]or-[***]21","deploymentArtifacts":"amplify-qurantutor-tutor-10621-deployment"}]) 2023-01-03T20:06:24.994Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileRegion(["default"]) 2023-01-03T20:06:24.995Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["default"]) 2023-01-03T20:06:25.016Z|info : amplify-provider-awscloudformation.aws-cfn.cfnModel.createStack([{"StackName":"[***]ify-[***]utor-[***]or-[***]21","Capabilities":["CAPABILITY_NAMED_IAM","CAPABILITY_AUTO_EXPAND"],"TemplateBody":"{\n \"AWSTemplateFormatVersion\": \"2010-09-09\",\n \"Description\": \"{\\\"createdOn\\\":\\\"Windows\\\",\\\"createdBy\\\":\\\"Amplify\\\",\\\"createdWith\\\":\\\"10.5.2\\\",\\\"stackType\\\":\\\"root\\\",\\\"metadata\\\":{}}\",\n \"Parameters\": {\n \"[***]cketName\": {\n \"Description\": \"Name of the common deployment bucket provided by the parent stack\",\n \"Type\": \"String\",\n \"Default\": \"DeploymentBucket\"\n },\n \"[***]eName\": {\n \"Type\": \"String\",\n \"Default\": \"AuthRoleName\"\n },\n \"[***]leName\": {\n \"Type\": \"String\",\n \"Default\": \"UnauthRoleName\"\n }\n },\n \"Resources\": {\n \"DeploymentBucket\": {\n \"Type\": \"AWS::S3::Bucket\",\n \"DeletionPolicy\": \"Retain\",\n \"Properties\": {\n \"BucketName\": {\n \"Ref\": \"DeploymentBucketName\"\n },\n \"BucketEncryption\": {\n \"ServerSideEncryptionConfiguration\": [\n {\n \"ServerSideEncryptionByDefault\": {\n \"SSEAlgorithm\": \"AES256\"\n }\n }\n ]\n }\n }\n },\n \"AuthRole\": {\n \"Type\": \"AWS::IAM::Role\",\n \"Properties\": {\n \"RoleName\": {\n \"Ref\": \"AuthRoleName\"\n },\n \"AssumeRolePolicyDocument\": {\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Deny\",\n \"Principal\": {\n \"Federated\": \"cognito-identity.amazonaws.com\"\n },\n \"Action\": \"sts:AssumeRoleWithWebIdentity\"\n }\n ]\n }\n }\n },\n \"UnauthRole\": {\n \"Type\": \"AWS::IAM::Role\",\n \"Properties\": {\n \"RoleName\": {\n \"Ref\": \"UnauthRoleName\"\n },\n \"AssumeRolePolicyDocument\": {\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Deny\",\n \"Principal\": {\n \"Federated\": \"cognito-identity.amazonaws.com\"\n },\n \"Action\": \"sts:AssumeRoleWithWebIdentity\"\n }\n ]\n }\n }\n }\n },\n \"Outputs\": {\n \"Region\": {\n \"Description\": \"CloudFormation provider root stack Region\",\n \"Value\": {\n \"Ref\": \"AWS::Region\"\n },\n \"Export\": {\n \"Name\": {\n \"Fn::Sub\": \"${AWS::StackName}-Region\"\n }\n }\n },\n \"StackName\": {\n \"Description\": \"CloudFormation provider root stack ID\",\n \"Value\": {\n \"Ref\": \"AWS::StackName\"\n },\n \"Export\": {\n \"Name\": {\n \"Fn::Sub\": \"${AWS::StackName}-StackName\"\n }\n }\n },\n \"StackId\": {\n \"Description\": \"CloudFormation provider root stack name\",\n \"Value\": {\n \"Ref\": \"AWS::StackId\"\n },\n \"Export\": {\n \"Name\": {\n \"Fn::Sub\": \"${AWS::StackName}-StackId\"\n }\n }\n },\n \"DeploymentBucketName\": {\n \"Description\": \"CloudFormation provider root stack deployment bucket name\",\n \"Value\": {\n \"Ref\": \"DeploymentBucketName\"\n },\n \"Export\": {\n \"Name\": {\n \"Fn::Sub\": \"${AWS::StackName}-DeploymentBucketName\"\n }\n }\n },\n \"AuthRoleArn\": {\n \"Value\": {\n \"Fn::GetAtt\": [\n \"AuthRole\",\n \"Arn\"\n ]\n }\n },\n \"UnauthRoleArn\": {\n \"Value\": {\n \"Fn::GetAtt\": [\n \"UnauthRole\",\n \"Arn\"\n ]\n }\n },\n \"AuthRoleName\": {\n \"Value\": {\n \"Ref\": \"AuthRole\"\n }\n },\n \"UnauthRoleName\": {\n \"Value\": {\n \"Ref\": \"UnauthRole\"\n }\n }\n }\n}","Parameters":[{"ParameterKey":"DeploymentBucketName","ParameterValue":"amplify-qurantutor-tutor-10621-deployment"},{"ParameterKey":"AuthRoleName","ParameterValue":"amplify-qurantutor-tutor-10621-authRole"},{"ParameterKey":"UnauthRoleName","ParameterValue":"amplify-qurantutor-tutor-10621-unauthRole"}],"Tags":[{"Key":"[***]tack","Value":"quran"},{"Key":"[***]ication","Value":"QuranTutor"}]}]) 2023-01-03T20:06:26.523Z|info : amplify-provider-awscloudformation.aws-cfn.cfnModel.createStack([{"StackName":"[***]ify-[***]utor-[***]or-[***]21","Capabilities":["CAPABILITY_NAMED_IAM","CAPABILITY_AUTO_EXPAND"],"TemplateBody":"{\n \"AWSTemplateFormatVersion\": \"2010-09-09\",\n \"Description\": \"{\\\"createdOn\\\":\\\"Windows\\\",\\\"createdBy\\\":\\\"Amplify\\\",\\\"createdWith\\\":\\\"10.5.2\\\",\\\"stackType\\\":\\\"root\\\",\\\"metadata\\\":{}}\",\n \"Parameters\": {\n \"[***]cketName\": {\n \"Description\": \"Name of the common deployment bucket provided by the parent stack\",\n \"Type\": \"String\",\n \"Default\": \"DeploymentBucket\"\n },\n \"[***]eName\": {\n \"Type\": \"String\",\n \"Default\": \"AuthRoleName\"\n },\n \"[***]leName\": {\n \"Type\": \"String\",\n \"Default\": \"UnauthRoleName\"\n }\n },\n \"Resources\": {\n \"DeploymentBucket\": {\n \"Type\": \"AWS::S3::Bucket\",\n \"DeletionPolicy\": \"Retain\",\n \"Properties\": {\n \"BucketName\": {\n \"Ref\": \"DeploymentBucketName\"\n },\n \"BucketEncryption\": {\n \"ServerSideEncryptionConfiguration\": [\n {\n \"ServerSideEncryptionByDefault\": {\n \"SSEAlgorithm\": \"AES256\"\n }\n }\n ]\n }\n }\n },\n \"AuthRole\": {\n \"Type\": \"AWS::IAM::Role\",\n \"Properties\": {\n \"RoleName\": {\n \"Ref\": \"AuthRoleName\"\n },\n \"AssumeRolePolicyDocument\": {\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Deny\",\n \"Principal\": {\n \"Federated\": \"cognito-identity.amazonaws.com\"\n },\n \"Action\": \"sts:AssumeRoleWithWebIdentity\"\n }\n ]\n }\n }\n },\n \"UnauthRole\": {\n \"Type\": \"AWS::IAM::Role\",\n \"Properties\": {\n \"RoleName\": {\n \"Ref\": \"UnauthRoleName\"\n },\n \"AssumeRolePolicyDocument\": {\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"\",\n \"Effect\": \"Deny\",\n \"Principal\": {\n \"Federated\": \"cognito-identity.amazonaws.com\"\n },\n \"Action\": \"sts:AssumeRoleWithWebIdentity\"\n }\n ]\n }\n }\n }\n },\n \"Outputs\": {\n \"Region\": {\n \"Description\": \"CloudFormation provider root stack Region\",\n \"Value\": {\n \"Ref\": \"AWS::Region\"\n },\n \"Export\": {\n \"Name\": {\n \"Fn::Sub\": \"${AWS::StackName}-Region\"\n }\n }\n },\n \"StackName\": {\n \"Description\": \"CloudFormation provider root stack ID\",\n \"Value\": {\n \"Ref\": \"AWS::StackName\"\n },\n \"Export\": {\n \"Name\": {\n \"Fn::Sub\": \"${AWS::StackName}-StackName\"\n }\n }\n },\n \"StackId\": {\n \"Description\": \"CloudFormation provider root stack name\",\n \"Value\": {\n \"Ref\": \"AWS::StackId\"\n },\n \"Export\": {\n \"Name\": {\n \"Fn::Sub\": \"${AWS::StackName}-StackId\"\n }\n }\n },\n \"DeploymentBucketName\": {\n \"Description\": \"CloudFormation provider root stack deployment bucket name\",\n \"Value\": {\n \"Ref\": \"DeploymentBucketName\"\n },\n \"Export\": {\n \"Name\": {\n \"Fn::Sub\": \"${AWS::StackName}-DeploymentBucketName\"\n }\n }\n },\n \"AuthRoleArn\": {\n \"Value\": {\n \"Fn::GetAtt\": [\n \"AuthRole\",\n \"Arn\"\n ]\n }\n },\n \"UnauthRoleArn\": {\n \"Value\": {\n \"Fn::GetAtt\": [\n \"UnauthRole\",\n \"Arn\"\n ]\n }\n },\n \"AuthRoleName\": {\n \"Value\": {\n \"Ref\": \"AuthRole\"\n }\n },\n \"UnauthRoleName\": {\n \"Value\": {\n \"Ref\": \"UnauthRole\"\n }\n }\n }\n}","Parameters":[{"ParameterKey":"DeploymentBucketName","ParameterValue":"amplify-qurantutor-tutor-10621-deployment"},{"ParameterKey":"AuthRoleName","ParameterValue":"amplify-qurantutor-tutor-10621-authRole"},{"ParameterKey":"UnauthRoleName","ParameterValue":"amplify-qurantutor-tutor-10621-unauthRole"}],"Tags":[{"Key":"[***]tack","Value":"quran"},{"Key":"[***]ication","Value":"QuranTutor"}]}]) 2023-01-03T20:06:31.557Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:06:36.583Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:06:41.587Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:06:46.599Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:06:51.613Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:06:56.612Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:07:01.614Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:07:06.631Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:07:11.639Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:07:16.649Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:07:21.646Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:07:26.659Z|info : amplify-provider-awscloudformation.aws-cfn.getStackEvents.cfnModel.describeStackEvents([{"StackName":"[***]ify-[***]utor-[***]or-[***]21"}]) 2023-01-03T20:07:29.526Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileRegion(["default"]) 2023-01-03T20:07:29.526Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["default"]) 2023-01-03T20:07:29.539Z|info : amplify-provider-awscloudformation.initializer.storeCurrentCloudBackend.s3.uploadFile([{"Key":"[***]rent-[***]ud-[***]d.zip"}]) 2023-01-03T20:07:29.544Z|info : amplify-provider-awscloudformation.aws-s3.uploadFile.s3.putObject([{"Body":{"_readableState":{"objectMode":false,"highWaterMark":65536,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":[],"flowing":null,"ended":false,"endEmitted":false,"reading":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"errorEmitted":false,"emitClose":true,"autoDestroy":false,"destroyed":false,"errored":null,"closed":false,"closeEmitted":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"dataEmitted":false,"decoder":null,"encoding":null},"_events":{},"_eventsCount":1,"path":"D:\\80gb_2\\Private\\Desktop\\University_Work\\Senior_Year_Project\\QuranTutor1218\\QuranTutor\\QuranTutor\\amplify\\backend\\.temp\\[***]rent-[***]ud-[***]d.zip","fd":null,"flags":"r","mode":438,"end":null,"autoClose":true,"bytesRead":0,"closed":false},"Key":"#current-cloud-backend.zip","Bucket":"[***]ify-[***]utor-[***]or-[***]21-[***]ment"}]) 2023-01-03T20:07:40.368Z|error : Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 DeploymentFault: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1 2023-01-03T20:08:40.184Z|info : amplify version core 2023-01-03T20:16:00.360Z|info : amplify diagnose core {"send-report":true,"yes":false} 2023-01-03T20:16:00.441Z|info : amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({} ```

Additional information

No response

Before submitting, please confirm:

josefaidt commented 1 year ago

Hey @maq796113 :wave: thanks for raising this! It appears the Amplify CLI is unable to fetch information from your project's deployment bucket.

from the logs:

2023-01-03T19:51:32.011Z|error : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1

Can you paste the contents of amplify/.config/local-aws-info.json redacting any sensitive information? Can you confirm whether the profile noted for the target environment exists in ~/.aws/credentials?

josefaidt commented 1 year ago

Closing due to inactivity