aws-amplify / aws-amplify/amplify-cli
CLI update auth causing removal of function environment variables
- 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?
yarn global
### If applicable, what version of Node.js are you using?
v16.14.2
### Amplify CLI Version
10.2.3
### 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.
No manual changes made
### Amplify Categories
auth, function
### Amplify Commands
update
### Describe the bug
When running the `amplify update auth` cli command, and selecting the Update OAuth social providers option, some function environment variables and their values are being removed from their respective json configurations
### Expected behavior
When updating an OAuth social provider, functions should maintain their environment variables and modules.
### Reproduction steps
Using an existing Cognito trigger function with a Google integration (**NB - Please let me know if I should expand this to creating the integration/hooks too**)
1. Edit an existing function, using `amplify update function`
2. Select the `Environment variables configuration` option
3. Enter a variable name, and variable value
4. Exit from the menu, and confirm the variables have been added to the function parameters. (amplify/backend/function/functionName/functionName-cloudformation-template.json and amplify/team-provider-info.json)
5. Run the `amplify update auth` command
6. Select the `Update OAuth social providers` option
7. Select the `Google` option and proceed
8. Enter Client ID and proceed
9. Enter Client Secret and proceed
10. Run `amplify status` to see that the Function has an Update operation pending
11. Run `git diff` and notice that amplify/backend/function/functionName/functionName-cloudformation-template.json and amplify/team-provider-info.json have had the environment variables removed from them.
### GraphQL schema(s)
_No response_
### Project Identifier
d269d4a9oyj3sv
### Log output
```
# Put your logs below this line
```
### Additional information
This project started on v6 of the CLI, and has been migrated up incrementally. I have had this issue from the outset and hoping for some help as I constantly have to check that the files haven't had the env variables removed.
If I am missing anything please let me know!
Contributor guide
Research direction
Start by reproducing `amplify update auth` with the Google OAuth provider and inspect the generated changes in `amplify/backend/function/functionName/functionName-cloudformation-template.json` and `amplify/team-provider-info.json`. Compare the files before and after the update; done means the function environment variables and values remain present and no unexpected Function update is reported by `amplify status`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- authentication, backend, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100