question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

amplify init adding profile with quotes

See original GitHub issue

Describe the bug When you run amplify init the cli is apparently adding to ~/.aws/config and ~/.aws/credentials with quotes, like so:

  • ~/.aws/config
["profile amplify-notes-eu-west-1 "]
region=eu-west-1
  • ~/.aws/credentials
["amplify-notes-eu-west-1 "]
aws_access_key_id=AKIAJ3KFAKEF7ZH6BNQ
aws_secret_access_key=m+somekey+GJOxVtSnA07/lvHqcd

To Reproduce Steps to reproduce the behavior:

  1. run amplify init, accept all defaults. output
? Do you want to use an AWS profile? Yes
? Please choose the profile you want to use amplify-notes-eu-west-1
⠋ Initializing project in the cloud...An error occurred when creating the CloudFormation stack
An error occurred when  creating the CloudFormation stack
✖ Root stack creation failed
init failed
{ ConfigError: Missing region in config
    at Request.VALIDATE_REGION (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/event_listeners.js:92:45)
    at Request.callListeners (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at callNextListener (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
    at /Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/event_listeners.js:86:9
    at finish (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/config.js:341:7)
    at /Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/config.js:359:9
    at /Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/credentials.js:123:23
    at SharedIniFileCredentials.callRefreshCallbacks (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/credentials/shared_ini_file_credentials.js:100:7)
    at SharedIniFileCredentials.refresh (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/credentials/shared_ini_file_credentials.js:182:12)
    at SharedIniFileCredentials.get (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/credentials.js:121:12)
  message: 'Missing region in config',
  code: 'ConfigError',
  time: 2018-12-04T12:02:57.569Z }
  • after fixing above, you get same error for credentials
? Do you want to use an AWS profile? Yes
? Please choose the profile you want to use amplify-notes-eu-west-1
⠋ Initializing project in the cloud...An error occurred when creating the CloudFormation stack
An error occurred when  creating the CloudFormation stack
✖ Root stack creation failed
init failed
{ CredentialsError: Missing credentials in config
    at SharedIniFileCredentials.refresh (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/credentials/shared_ini_file_credentials.js:175:11)
    at SharedIniFileCredentials.get (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/credentials.js:121:12)
    at getAsyncCredentials (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/config.js:353:24)
    at Config.getCredentials (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/config.js:373:9)
    at Request.VALIDATE_CREDENTIALS (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/event_listeners.js:81:26)
    at Request.callListeners (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/sequential_executor.js:102:18)
    at Request.emit (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/prisc_000/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/amplify-provider-awscloudformation/node_modules/aws-sdk/lib/state_machine.js:14:12)
  message: 'Missing credentials in config',
  code: 'CredentialsError',
  time: 2018-12-04T12:04:41.424Z,
  originalError:
   { message: 'Could not load credentials from SharedIniFileCredentials',
     code: 'CredentialsError',
     time: 2018-12-04T12:04:41.424Z,
     originalError:
      { message: 'Credentials not set for profile amplify-notes-eu-west-1',
        code: 'SharedIniFileCredentialsProviderFailure',
        time: 2018-12-04T12:04:41.424Z } } }
  • vim into ~/.aws/config and ~/.aws/credentials remove quotes, rerun and works. Expected behavior amplify configure should place the region and credentials into ~/.aws/config and ~/.aws/credentials in proper format without quotes.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jkeys-ecg-nmsucommented, Dec 5, 2018

@idkjs Hopefully those are fake access and secret access keys? Otherwise you need to disable that keypair and rotate your credentials.

1reaction
yuthcommented, Dec 4, 2018

Thanks for reporting this issue. It looks like the profile name had an empty space at the end and that caused it to be save the profile name with quotes

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to configure usage of AWS profile during amplify init?
After installation of AWS CLI, you can configure your CLI using aws configure command. You provide access key, secret access key and default ......
Read more >
Amplify CLI simplifies starting from existing Amplify projects ...
Add a new plugin. First, run the amplify plugin init command from an empty directory. Alternatively, you can use its alias amplify plugin...
Read more >
Building a Ron Swanson Quote App on Amplify ... - Steamhaus
Now you can move into the new working directory: aws-amplify-swanson and initialise Amplify with amplify init. You can configure Auth here or use...
Read more >
Build an Authentication System with AWS Amplify, Cognito ...
Profile Name: my-profile-name Successfully set up the new user. Step 3: Initialize Amplify in the React app. Run the following command and enter ......
Read more >
Tracking and Reminders in AWS Amplify | by Jan Hesters
yarn add aws-amplify aws-amplify-react react-router-dom ... Run amplify init to initialize your project. ... Therefore we need user profiles. To add ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found