AWS_Lambda_in_Action icon indicating copy to clipboard operation
AWS_Lambda_in_Action copied to clipboard

ch7 - Simple Website - bug fixes

Open jleatham opened this issue 7 years ago • 0 comments

This is for the book.
You need to mention that in the API gateway, not only do you need to change the 'Integration Response' 200 body to 'text/html' , but you also need to change the 'Method Response' 200 body to 'text/html' , otherwise, it will render as JSON in your browser.

Also, your ejs code does not handle the extra /page/ URL path, so when you go to your <aws.com>// URL api, it will load your href links as <aws.com>//page-one and you will receive an error. Your EJS code doesn't know anything about the /page/ api. In the current state, the only way to get to your page-one, page-two, page-three URLs, is to manually put it into your browser as: <aws.com>//page/page-one, etc .

I fixed this by deleting the /page/{page}/get resource and recreated it as /{page} . This will allow for the proper redirects to the sub URLs in the website. One more minor lesson learned: <aws.com>// <--- make sure you put the trailing slash </> at the end. Otherwise the sub URLs will not load properly. This problem would go away if you redirected the API call to your real websites DNS.

Just an FYI for anyone else running into an issue. Thanks for the book!

jleatham avatar Apr 25 '17 22:04 jleatham