aws-amplify / aws-amplify/amplify-hosting

PR Previews fail with SIWA auth config when creating separate backend for each PR

Open
#2,772 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

I have the following setup:

- Auth config with Cognito. Google, and SIWA.
- Builds are working fine on my `dev`, `test`, and `production` environments.
- I enabled previews and choose to create a separate backend for each PR.

The problem, builds fail on first run with the following error:
```
2022-05-27T12:48:59.700Z [INFO]: CREATE_IN_PROGRESS OAuthCustomResourceInputs Custom::LambdaCallout Fri May 27 2022 12:48:55 GMT+0000 (Coordinated Universal Time) Resource creation Initiated
CREATE_FAILED OAuthCustomResourceInputs Custom::LambdaCallout Fri May 27 2022 12:48:55 GMT+0000 (Coordinated Universal Time) Received response status [FAILED] from custom resource. Message returned: See the details in CloudWatch Log Stream: 2022/05/27/[$LATEST]3ed99d37d2504da69e750e011db109bf (RequestId: c04b6906-c8e0-4bcc-924c-52587cdaf7d0)
CREATE_FAILED amplify-myappweb-prff-124234-authmyappAuth-6IOW6Z8GMYS7 AWS::CloudFormation::Stack Fri May 27 2022 12:48:56 GMT+0000 (Coordinated Universal Time) The following resource(s) failed to create: [OAuthCustomResourceInputs].
2022-05-27T12:49:24.618Z [INFO]:
2022-05-27T12:49:24.619Z [INFO]: CREATE_FAILED authmyappAuth AWS::CloudFormation::Stack Fri May 27 2022 12:49:20 GMT+0000 (Coordinated Universal Time) Embedded stack arn:aws:cloudformation:ap-southeast-2:535240017633:stack/amplify-myappweb-prff-124234-authmyappAuth-6IOW6Z8GMYS7/b185e340-ddba-11ec-a0e3-0ab7992d0212 was not successfully created: The following resource(s) failed to create: [OAuthCustomResourceInputs].
```

and upon checking cloudwatch I see the following error:

```
"err": {
"message": "The provider SignInWithApple does not exist for User Pool ap-southeast-2_XXXXXX.",
"code": "InvalidParameterException",
"time": "2022-05-27T10:27:47.030Z",
"requestId": "1675420d-d5ed-4738-9dc3-ec0a801bc517",
"statusCode": 400,
"retryable": false,
"retryDelay": 12.985776847508612
}
```

by the looks of it, it is a race issue while creating resources because if I pull the new env locally and push the `team-provider-info.json` the build works just fine.

any ideas on how to resolve this issue. it's really limiting us.

Contributor guide

Open the contributing guide

Research direction

Start with the CloudWatch error for OAuthCustomResourceInputs and compare the first preview backend creation with the locally pulled environment and team-provider-info.json. Reproduce the separate-backend preview using Cognito, Google, and SIWA; done means the initial preview build completes without the SignInWithApple provider error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
authentication, ci-cd, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.