Open nylltz opened 2 years ago
Hey @nylltz :wave: thanks for raising this! Unfortunately this is not currently supported, and unfortunately this Lambda is not exposed to the override for auth overrides to be a viable workaround. Marking this as a feature request 🙂
Hi @josefaidt , thank you for taking it as a feature request. May I know the roadmap to implement it? Currently, my client has to update the Amplify generated CFN template before pushing it to Cloud. However, as I said the CFN template rollback so the change can't be saved
Hey @nylltz absolutely, and unfortunately I do not have a defined timeline for this feature request. However, if we know the CloudFormation we want to add or override perhaps auth overrides would be a suitable solution.
honestly.. its quite annyoing this sdk still suffers from these issues even after 2 years.. why do we have to research day and night and figure out workaround when we wanna deploy one single cognito lambda trigger. unbelievable.
Is this feature request related to a new or existing Amplify category?
auth, function
Is this related to another service?
No response
Describe the feature you'd like to request
My Amplify CLI version is
7.6.3
. I experienced an issue that is similar to #9510 . The custom resource CustomAuthTriggerResource that Amplify CLI generate for configuring Cognito user pool Lambda trigger come with only a 3 seconds Timeout, which is often not enough for responding CloudFormation a SUCCESS signal. When it times out due to network latency, the Amplify generated CloudFormation stack (usually named as "..AuthTriggerCustomLambdaStack") gets stuck in UPDATE_ROLLBACK_FAILED status after 1 hour. As a consequence, user is unable to make any subsequent push using Amplify CLI.In the template {PROJ_DIR}/amplify/backend/auth/test9656353151790fa62d/build/auth-trigger-cloudformation-template.json , we can see this custom resource is used for configuring a Lambda function as Cognito user pool Lambda trigger:
The true trouble maker is the referenced Lambda function authTriggerFn7FCFA449. The inline function receives CloudFormation request and provide a SUCCESS | FAILED response. When Amplify CLI generated this inline function with cfn-response, it configures the function with the default 3 seconds Timeout. User doesn't have a chance to increase the timeout before making amplify push, unless manually change the template file every time .
Reproduce the issue
To simulate the timeout issue, I can manually add a line
await new Promise(resolve => setTimeout(resolve, 5000));
on the above inline code and make a push. The CloudFormation then gets stuck because can't receive a SUCCEE or FAILED signal, and failed to UPDATE_ROLLBACK_FAILED state.Workaround
After researching it for a couple of days, I find a workaround to unblock the CloudFormation in stuck.
console.log("REQUEST RECEIVED:\n" + JSON.stringify(event));
Describe the solution you'd like
I believe the issue actually is made by an Amplify CLI design defect, though I can use the above workaround to fix it. I know that I can increase the default Timeout setting by adding a Timeout:300 on the template {PROJ_DIR}/amplify/backend/auth/test9656353151790fa62d/build/auth-trigger-cloudformation-template.json before amplify push
but Amplify CLI will rollback the above template, so the change cannot be saved. The perfect solution will be providing an option when Amplify CLI configure Cognito Lambda trigger, to make the Timeout configurable.
Describe alternatives you've considered
Or, Amplify CLI can simply increase the Timeout longer, e.g: 10 seconds, when it created the Lambda function. The default Timeout 3 seconds is too short to respond CloudFormation.
Additional context
No response
Is this something that you'd be interested in working on?
Would this feature include a breaking change?