Categories
Mastering Development

configure nodejs rest api server and vue project with axios cors policy error

as the title sais, i’m trying to configure a local rest api server running node js and in the meantime i have a vue project with axios. i surfed the whole internet, tried every server/client configuration, server headers settings, cors package, axios header config, but i still have cors policy error inthe console. postman works […]

Categories
Mastering Development

AWS Lambda + Gateway API + React JS

I am trying to post to my dynamoDB using react however I am getting the following error: Access to fetch at ‘https://xxxxx.execute-api.us-west-2.amazonaws.com/prod/getuserprofile’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch […]

Categories
Mastering Development

SAM app deploy gives preflight error but if I create OPTIONS method in aws apigateway console my preflight passes

I’m using SAM to create an API in cloudformation. QUESTION: Where in my SAM application template do I add the ‘X-Requested-With’ header? How can I edit my code so that the preflight will succeed without me having to go into the AWS console? PROBLEM: I’m working with my preflight request and when I deploy my […]

Categories
Mastering Development

API Gateway HTTP API CORS

I am using the new API Gateway HTTP which during the configuration enables you to add CORS. So I have set the Access-Control-Allow-Origin Header with the setting *. However when I make a request using Postman I do not see that header and this i causing my VueJS Axios request to fail. I previously used […]

Categories
Development

502 error with no CORS headers in CloudFront Response [duplicate]

This question already has an answer here: 5xx or 4xx error with “No 'Access-Control-Allow-Origin' header is present” 2 answers I do not receive the CORS headers back from Cloudfront Distro. Why is this ? I have whitelisted and successfully Forwarded “Origin” to my origin which is API-GW using a LambdaProxy Integration. The lambda execution is […]

Categories
Development

Terraform API Gateway with Lambda integration

I’ve started using terraform a few days ago, so I am a beginner in this topic. I want to create an API Gateway and a Lambda with a Layer as a custom runtime to run R script. Here are my Terraform files: lambda.tf resource “aws_lambda_function” “testlambda” { function_name = “rlambda” s3_bucket = “mybucket” s3_key = […]