The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

607835 (2) [Avatar] Offline
Working my way through the course, and learning a great deal along the way, but struggling with the above section, I've come to the end of the section but when I try to search for restaurants I get a pop-up stating "message: "Authorization header requires 'Credential' parameter. Authorization header requires 'Signature' parameter. Authorization header requires 'SignedHeaders' parameter. Authorization header requires existence of either a 'X-Amz-Date' or a 'Date' header. Authorization=ey......."

In the Chrome Developer Tools Console I can see the idToken and the session validity is true but I'm getting a 403 back

Any ideas on where I have gone wrong?


Yan Cui (73) [Avatar] Offline
Hi Jon,

That error sounds like the search-restaurants endpoint is configured with AWS_IAM authentication (which is why it's looking for the X-Amz-Date header). I'd have a look at the API Gateway configuration for the search endpoint and see what it's configured with, and then go back to the serverless.yml to make sure the search endpoint is configured correctly.

You can always go to this page to see all the code snapshots at the end of each module if you're stuck.

607835 (2) [Avatar] Offline
Hi Yan,

Thank you for coming back to me so promptly!

I've reviewed my code and compared it to the code you linked to (section 2.7) get-index.js and found that the code in your link is slightly different to the code shown on screen. In 'Securing API endpoints with Cognito User Pools' around 6:29 you update view with the variables in a different order... I changed it to as shown in GitHub and search is now working

Correct order is
let view = {
searchUrl: `${restaurantsApiRoot}/search`

Thanks again for a great course and prompt response.


UPDATE: It is not the order but my use of single quotes around the searchUrl, I had searchUrl: '${restaurantsApiRoot}/search' where as it should be searchUrl: `${restaurantsApiRoot}/search`