antonputra/tutorials

tutorial 118 without custom domain

Closed this issue · 1 comments

Hi, thank you so much for such great tutorial.
I followed the example 2 step by step, using aws console as well as terraform. however, when I call my api curl -i https://x1rjhowt93.execute-api.us-east-1.amazonaws.com/staging/health, I get the following response.

HTTP/2 404 
date: Wed, 19 Jul 2023 16:54:14 GMT
content-type: text/html; charset=utf-8
content-length: 153
x-powered-by: Express
content-security-policy: default-src 'none'
x-content-type-options: nosniff
apigw-requestid: IUhAiierIAMEJfQ=

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /staging/health</pre>
</body>
</html>

I've ssh into the instance using session manager and my-app is running and the instance is healthy.
I've been looking at various sources to debug the issue for almost a day, but I haven't found any solution.
To reproduce, I followed all the steps in example-2 until making the certificated and adding custom domain. Using terraform, I remove the .tf files related to the certificate and custom domain and run terraform apply.

ls
10-ec2-example-2.tf  12-api-gw-example-2.tf  2-igw.tf      4-nat.tf     9-sg-example-2.tf  main.tf
11-nlb-example-2.tf  1-vpc.tf                3-subnets.tf  5-routes.tf

Thank you very much for the help

it turns out I either need to add the custom domain or change the apis in the app.js to /staging/health and staging/fibonacci because the api gatewway has staging.
anyway, thank you for all the helpful tutorials.