aws-amplify / aws-amplify/amplify-cli
Why do we need projectPath in `amplify/.config/local-env-info.json`? it cause an issue if the project folder is renamed
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### How did you install the Amplify CLI?
_No response_
### If applicable, what version of Node.js are you using?
_No response_
### Amplify CLI Version
12.10.1
### What operating system are you using?
ubuntu
### Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
### Describe the bug
I renamed the folder of the project, and the command like `amplify update auth` started to ignore all existing parameters
### Expected behavior
The rename (or move) of the folder that contains the project has no side effect on the project.
I think we can use only relative paths to find the parameter files just like we find the `amplify-meta.json`
the issue is caused by [this lines ](https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-provider-awscloudformation/src/resourceParams.js#L7) if we instead relay on `search project root` [like we do here](https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-cli-core/src/state-manager/pathManager.ts#L279-L282) that will resolve this kind of errors
### Reproduction steps
1) init an amplify project
2) execute `amplify add auth`
3) rename the project folder
4) execute `amplify update auth`
And you won't see any of the values you configured on `amplify add auth` the cli will suggest new names for cognito user pool and identity pool
### Project Identifier
_No response_
### Log output
_No response_
### Additional information
One can fix the issue caused by moving the project folder by manually changing the path in the `amplify/.config/local-env-info.json` but it took a few days from me to figure out what was the issue in the first place.
here is [my question at re:Post ](https://repost.aws/questions/QUBHmBFMbKRGWiwLzVmAVvZw/aws-amplify-update-auth-attempts-to-create-a-new-auth-instead-of-updating-an-existing-one-amplify-cli-version-12-10-1)
and [in discord server](https://discord.com/channels/705853757799399426/1195314117746098206/1195314117746098206)
### Before submitting, please confirm:
- [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.
Contributor guide
Research direction
Start with packages/amplify-provider-awscloudformation/src/resourceParams.js at the referenced lines and compare it with the project-root search in packages/amplify-cli-core/src/state-manager/pathManager.ts. Reproduce the issue by renaming an initialized project folder, running amplify update auth, and confirming that the existing auth values remain available instead of being replaced by new suggestions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- authentication, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100