In this lesson we’ll learn how to create a Lambda function and use AWS Amplify to interact with the Lambda function from a React app. Lambda functions allow us to easily create one off functionality or interact with microservices. We’ll use the Lambda function to translate text from english to spanish.
Thanks Nader, as always amazing explanations. Just found 2 small typos on the code:
const.people = [ ]
people:
Note: the typo is in the transcripted code, not on the code in the video.
This is a great video!
Can I serve static from the backend function (for server side rendering case)? If yes, how can I do that? where should I put the static files?
Can I serve static from the backend function (for server side rendering case)? If yes, how can I do that? where should I put the static files?
Yes, you can do this. As long as the files are located in the main project root, it should work. Gatsby is a popular use case for this.
AppSync now has functions
Ran into an issue where the amplify push
command didn't work after setting up the api. I ran amplify-init
again and this seemed to solve the issue. In case you also run into it, find reference here:
https://github.com/aws-amplify/amplify-cli/issues/195
I get a 502 while making a get call on peopleapi. Would anyone be able to help
never mind it was a silly mistake on my end
I keep getting a 403 Error message Access to XMLHttpRequest at 'https://8w9xad2in3.execute-api.us-west-2.amazonaws.com/amplifyapp/people' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. I've created a user with an authentication token and signed in. Any idea what could be the issue here?
https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html
I'm running into an issue with authentication enabled, and getting a 403 on the endpoint. In API Gateway I am seeing "Auth: AWS_IAM" for both of the ANY endpoints, and I am logged into the app using the withAuthenticator HOC. Seems like somehow the app isn't either looking for the logged in token, not passing it, or not honoring it.
Any ideas?
CORS is set up by default in app.js in the express app. It's the issue with aws role not having access to the execute-api:Invoke action. Please try to do the failing GET request in postman or curl and there you can see what role is missing which action for what resource. In my case it was adding this policy to one of the roles: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-iam-policy-examples-for-api-execution.html First one at the top.
Looks like the star wars api address has been updated to swapi.dev