aws-amplify / aws-amplify/amplify-cli

Amplify init truncates profile names after the first occurrence of a "."

Open
#10,525 3 comments 0 reactions 0 assignees View on GitHub
bug p2 platform platform-init
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Before opening, please confirm:

- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-cli/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-cli/blob/master/CONTRIBUTING.md#bug-reports).
- [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.

### How did you install the Amplify CLI?

npm

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

v14.9.3

### Amplify CLI Version

8.3.1

### What operating system are you using?

Ubuntu 22.04 (via WSL2 on Windows 10)

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

No manual changes mad

### Amplify Categories

Not applicable

### Amplify Commands

init

### Describe the bug

Profiles that contain a dot are truncated before the dot.

### Expected behavior

The list of profiles should look like:
? Please choose the profile you want to use (Use arrow keys)
❯ sandbox-dan.hook

### Reproduction steps

In ~/.aws/config Create a profile with a name that contains a dot:
[profile sandbox-dan.hook]
....

Run amplify init and answer the questions in the following way:
Note: It is recommended to run this command from the root of your app directory
? Do you want to use an existing environment? No
? Enter a name for the environment dhook
? Choose your default editor: Visual Studio Code
Using default provider awscloudformation
? Select the authentication method you want to use: AWS profile

The list of profiles will look like:
? Please choose the profile you want to use (Use arrow keys)
❯ sandbox-dan
Selecting it results in
"Failed to get profile: Cannot read property 'accessKeyId' of undefined"

### GraphQL schema(s)

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `amplify init` with an AWS profile named `sandbox-dan.hook` in `~/.aws/config`, then trace the profile parsing and selection flow used by the init command. Done means the prompt displays the complete profile name and selecting it no longer produces the `accessKeyId` error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, node.js, typescript
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.