aws-amplify / aws-amplify/amplify-cli

Adding additional sign-up/sign-in redirect URIs using `amplify update auth` removes env vars from unrelated PreSignUp lambda function

Open
#13,590 1 comment 0 reactions 0 assignees View on GitHub
auth bug functions p2
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

npm

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

v21.6.1

### Amplify CLI Version

12.10.1

### What operating system are you using?

MacOS 14.2.1 (23C71)

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

Configured WAF rules and logging for Appsync

### Describe the bug

Adding additional sign-up / sign in URI removes env vars from unrelated PreSignUp function

### Expected behavior

Only update the sign-in / sign-out URIs
Do not make updates to unrelated functions

### Reproduction steps

1. Setup an environment that uses Auth configured with Google and a custom PreSignup function
2. Configure a custom env var for PreSignup function
3. Use `amplify update auth` to add two additional sign-in/sign-out URIs.
4. `amplify status` shows changes to Auth module as expected but also to Function module for the xxxPreSignUp function which is unexpected.
5. Investigation shows that custom env var for xxxPreSignUp has been removed from:
- amplify/backend/function/xxxPreSignup/xxxPreSignup-cloudformation-template.json
- amplify/backend/function/xxxPreSignup/function-parameters.json
- amplify/backend/backend-config.json

### Project Identifier

682e0d66e3a50d4839b5c4d402d6addf

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

### 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

Open the contributing guide

Research direction

Reproduce the issue with amplify update auth and inspect the generated files under amplify/backend/function/xxxPreSignup, especially xxxPreSignup-cloudformation-template.json, function-parameters.json, and backend-config.json. Compare those files before and after adding the redirect URIs. Done means the Auth changes are retained while the PreSignUp function's custom environment variable remains present and the function is not marked as changed.

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
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.