Testing in API Gateway:
Status: 502
Response Body:
{"message": "Internal server error"}
Logs:
Lambda execution failed with status 200 due to customer function error: RequestId: 80572150-944e-40e5-b782-aca7f713289f Process exited before completing request. Lambda request id: 80572150-944e-40e5-b782-aca7f713289f
Check your lambda function is either:
Make sure you define your handler function async
; or
Use the callback
argument in your handler
For example:
export async function webhook(event, context) {return {statusCode: 200,};}
or
export function webhook(event, context, callback) {callback(null, { statusCode: 200 });}
Open AWS ACM Console (us-east-1)
Click "Request a Certificate"
Enter the domains you want to enable
Open AWS API Gateway​
Select "Custom Domain Names" from the left menu.
Click the "Create Custom Domain Name" button.
Enter the "Domain Name"
Select the ACM Certificate (us-east-1)
Click "Base Path Mappings"
Set the relevant path and destination
Hit "Save"
Wait a maximum of 40 minutes
Open Cloudflare​
Select your domain and open the "DNS" tab
Add a CNAME record
For "Name":
Use "@" if you are targeting the root domain. For example "build.my"
Use "www" if you are targetting a subdomain. For example: "www.build.my"
For "Domain name":
Use the AWS APIGateway Target Domain Name. For example: "d1jdvkqtea2e81.cloudfront.net"
For Status:
Set to: DNS Only
Test only on https
. Testing on http
will redirect to https
so it looks like nothing is happening.
curl --verbose https://dt.cards/
Pieced from:
​