aws-amplify / aws-amplify/amplify-cli

Lambda triggers are not attached to the Cognito Userpool for auto-detected git branches and PR previews

Open
#9,892 7 comments 2 reactions 0 assignees View on GitHub
bug functions p2 transferred
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-console/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-console/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

### App Id

_No response_

### Region

ap-southeast-1

### Amplify Console feature

Backend builds, Build settings

### Describe the bug

I have used amplify-cli to add Cognito auth and attach lambda triggers. When I run `amplify push` locally, it is able to successfully attach those lambda triggers to the Userpool, and I am able to see those in the Userpools > Triggers in the AWS console.
Screenshot 2021-11-19 at 12 53 14 PM

But when I push to git and let Amplify Console deploy a build, the CI passes successfully, but the triggers are not attached to the Userpool.
Screenshot 2021-11-19 at 12 38 14 PM

### Expected behavior

`amplifyPush --simple` should be able to attach auth Lambda triggers to the Userpool

### Reproduction steps

1. amplify add auth
2. When it asks: "Do you want to configure Lambda Triggers for Cognito", select all available options
3. Run `amplify push`, let it complete. Then open the Userpool from AWS console > Triggers tab. You should see all the lambda triggers attached to their respective events (i.e. Pre-Signup etc)
4. Commit your changes and push to git, to trigger the Amplify Console CI. Let the CI complete
5. Open the Userpool from AWS console again > Triggers tab. This time, none of the auth events have any trigger attached

### Build Settings

```yaml
version: 1
backend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- amplifyPush --simple
cache:
paths:
- node_modules/**/*
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
```
```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.