aws-amplify / aws-amplify/amplify-cli

`amplify push` Adds unnecessary newline to `auth/cli-inputs.json`

Open
#11,330 10 comments 1 reaction 0 assignees View on GitHub
auth bug p2 pending-review
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/dev/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?

14.18.2

### Amplify CLI Version

10.4.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.

No manual changes made

### Amplify Categories

auth, custom, storage, function, api, hosting

### Amplify Commands

push

### Describe the bug

As a background: we currently cannot make any changes to our `auth` category due to to #9525 , which doesn't seem likely to get fixed any time soon.

The problem I'm raising here is that running `amplify push` ALWAYS wants to make a (seemingly trivial) change to the file `amplify/backend/auth/.../cli-inputs.json`, to add a newline at the end.

This means we can't run an `amplify push` at all, because it updates the `auth` category despite us having made no changes to it, and the `auth` category is broken due to #9525.

### Expected behavior

The CLI shouldn't automatically change anything in the `auth` category unless it's necessary.

### Reproduction steps

1. (Optional) Use one of the projects that the reporters of #9525 have identified, that give issues with the `auth` category.
2. Make any other change to your local amplify config
3. Amplify push

### GraphQL schema(s)

```graphql
# Put schemas below this line

```

### Project Identifier

_No response_

### Log output

```
mikecunneen@Mikes-Air-M1 bp-edsys % amplify env pull --restore
✔ Successfully pulled backend environment develop from the cloud.

mikecunneen@Mikes-Air-M1 bp-edsys % amplify status

Current Environment: develop

┌──────────┬───────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ bpedsysauthCustomMessage │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ bpedsysauthPostConfirmation │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ AdminQueries10a2580d │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadClassList │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadtestdata │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadstudentattributes │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadtestresults │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ schooltrigger │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ schoolstudenttrigger │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ gapAnalysisTests │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ getGapAnalysisData │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ doGapAnalysisNew │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ doIST │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ bpedsysauthPreTokenGeneration │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Auth │ userPoolGroups │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Auth │ bpedsysauth │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ AdminQueries │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ bpedsysgql │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ bprestapi │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ GapAnalysisApi │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Storage │ bpuserstorage │ No Change │ awscloudformation │
└──────────┴───────────────────────────────┴───────────┴───────────────────┘

GraphQL endpoint: https://[REDACTED].appsync-api.ap-southeast-2.amazonaws.com/graphql

GraphQL transformer version: 1
REST API endpoint: https://[REDACTED].execute-api.ap-southeast-2.amazonaws.com/develop

Amplify hosting urls:
┌──────────────┬──────────────────────────────────────────────┐
│ FrontEnd Env │ Domain │
├──────────────┼──────────────────────────────────────────────┤
│ dev │ https://[REDACTED] │
│ ├──────────────────────────────────────────────┤
│ │ https://[REDACTED] │
├──────────────┼──────────────────────────────────────────────┤
│ master │ https://master.[REDACTED].amplifyapp.com │
│ ├──────────────────────────────────────────────┤
│ │ https://[REDACTED] │
│ ├──────────────────────────────────────────────┤
│ │ https://[REDACTED] │
└──────────────┴──────────────────────────────────────────────┘
mikecunneen@Mikes-Air-M1 bp-edsys % amplify env checkout develop

✔ Initialized provider successfully.
✅ Initialized your environment successfully.

***Add my custom category, no modifications to the auth category: amplify push decides to modify auth anyway***

mikecunneen@Mikes-Air-M1 bp-edsys % amplify status

Current Environment: develop

┌──────────┬───────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Custom │ pinpoint │ Create │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ bpedsysauthCustomMessage │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ bpedsysauthPostConfirmation │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ AdminQueries10a2580d │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadClassList │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadtestdata │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadstudentattributes │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadtestresults │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ schooltrigger │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ schoolstudenttrigger │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ gapAnalysisTests │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ getGapAnalysisData │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ doGapAnalysisNew │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ doIST │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ bpedsysauthPreTokenGeneration │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Auth │ userPoolGroups │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Auth │ bpedsysauth │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ AdminQueries │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ bpedsysgql │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ bprestapi │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ GapAnalysisApi │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Storage │ bpuserstorage │ No Change │ awscloudformation │
└──────────┴───────────────────────────────┴───────────┴───────────────────┘

GraphQL endpoint: https://[REDACTED].appsync-api.ap-southeast-2.amazonaws.com/graphql

GraphQL transformer version: 1
REST API endpoint: https://[REDACTED]execute-api.ap-southeast-2.amazonaws.com/develop

Amplify hosting urls:
┌──────────────┬──────────────────────────────────────────────┐
│ FrontEnd Env │ Domain │
├──────────────┼──────────────────────────────────────────────┤
│ dev │ https://dev.[REDACTED].amplifyapp.com │
│ ├──────────────────────────────────────────────┤
│ │ https://[REDACTED] │
├──────────────┼──────────────────────────────────────────────┤
│ master │ https://master.[REDACTED].amplifyapp.com │
│ ├──────────────────────────────────────────────┤
│ │ https://[REDACTED] │
│ ├──────────────────────────────────────────────┤
│ │ https://[REDACTED] │
└──────────────┴──────────────────────────────────────────────┘

mikecunneen@Mikes-Air-M1 bp-edsys % amplify push

✔ Successfully pulled backend environment develop from the cloud.

Current Environment: develop

┌──────────┬───────────────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Custom │ pinpoint │ Create │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Auth │ bpedsysauth │ Update │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ bpedsysauthCustomMessage │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ bpedsysauthPostConfirmation │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ AdminQueries10a2580d │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadClassList │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadtestdata │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadstudentattributes │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ loadtestresults │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ schooltrigger │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ schoolstudenttrigger │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ gapAnalysisTests │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ getGapAnalysisData │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ doGapAnalysisNew │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ doIST │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Function │ bpedsysauthPreTokenGeneration │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Auth │ userPoolGroups │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ AdminQueries │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ bpedsysgql │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ bprestapi │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Api │ GapAnalysisApi │ No Change │ awscloudformation │
├──────────┼───────────────────────────────┼───────────┼───────────────────┤
│ Storage │ bpuserstorage │ No Change │ awscloudformation │
└──────────┴───────────────────────────────┴───────────┴───────────────────┘
? Are you sure you want to continue? No

```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the behavior with `amplify push` and inspect the generated `amplify/backend/auth/.../cli-inputs.json` file. Trace the CLI path that updates this file when another category changes, then verify that an unchanged auth category is left untouched and that the reported reproduction no longer shows an unnecessary newline change.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
authentication, cli
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.