Amplify Custom Resource deployment errors, "S3 Error Message: The specified bucket does not exist" #13142
Closed
2 tasks done
Labels
custom-cdk
Issues related to custom CDK resource functionality
pending-response
Issue is pending response from the issue author
pending-triage
Issue is pending triage
How did you install the Amplify CLI?
nom
If applicable, what version of Node.js are you using?
18.16.1
Amplify CLI Version
12.3.0
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
"No manual changes made"
Describe the bug
We added a custom resource to modify one of the amplify sources. We added the custom resource by using the "amplify add custom" command from terminal. The issue we are having, is that when the custom resource contains certain constructs, in our case a route53 RecordSet. We did lose some time thinking the stack wasn't deploying the custom resource, after looking in the console we noticed that indeed the custom resources. Below is the output from the cli after performing "amplify push"
These are the actually errors reported from the cli.:
🛑 The following resources failed to deploy:
Resource Name: AWS679f53fac002430cb0da5b7982bd22872D164C4C (AWS::Lambda::Function)
Event Type: create
Reason: Resource handler returned message: "Error occurred while GetObject. S3 Error Code: NoSuchBucket. S3 Error Message: The specified bucket does not exist (Service: Lambda, Status Code: 400, Request ID: f89fd0c2-2279-4852-8fc3-284d952b063c)" (RequestToken: 96ed14c9-d1bf-328e-2b4c-7c29d947857a, HandlerErrorCode: InvalidRequest)
🛑 CFN Deployment failed for custom resources.
Name: AWS679f53fac002430cb0da5b7982bd22872D164C4C (AWS::Lambda::Function), Event Type: create, Reason: Resource handler returned message: "Error occurred while GetObject. S3 Error Code: NoSuchBucket. S3 Error Message: The specified bucket does not exist (Service: Lambda, Status Code: 400, Request ID: f89fd0c2-2279-4852-8fc3-284d952b063c)" (RequestToken: 96ed14c9-d1bf-328e-2b4c-7c29d947857a, HandlerErrorCode: InvalidRequest), IsCustomResource: true
Expected behavior
Should complete without errors, as after using "amplify push" all the resources are deployed as expected and work. If there is a need for amplify to create a lambda for a custom resource, which not sure in our case is really needed, it should create the bucket or use the existing deployment bucket.
Reproduction steps
1.) Create a new amplify project, with auth backend resource.
2.) Run "amplify add custom" and enter any name for the custom resource name
3.) In the custom resource add the code below, you will need to change the domain to one that can be verified in your project.
Project Identifier
No response
Log output
Additional information
I also tried changing route53.RecordSet to route53.ARecord and used a binding for and passed the hostedzoneId for CloudFontDist and the user pool cloud front domain. My thinking was maybe the describe cert need for the target type UserPoolDomainTarget was why it was trying to create the lambda. Changing it to ARecord also worked and created the resources as expected but also returned the same bucket error.
If I leave only the Cert and UserPoolDomain constructs, the lambda and role are not made and there is no error, it's only upon using any route53 record construct.
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: