Serverless Framework API Gateway CORS config

If you deploy a Serverless Framework Java Lambda to AWS and attempt to call it locally while developing your frontend, you’ll run into a CORS error like this: Access to XMLHttpRequest at ‘https://abc.execute-api.us-west-1.amazonaws.com/some/api’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is …

‘serverless invoke local’ with Java Lambdas

If you create a Java Lambda with the provided template, you’re probably returning a response using the provided ApiGatewayResponseClass. If you run your Lambda locally with ‘serverless invoke local –function functioname’, you’ll see a response like this: Serverless: Invoke invoke:local Serverless: In order to get human-readable output, please implement “toString()” method of your “ApiGatewayResponse” object. …

Serverless framework deploy for Java AWS Lambdas

The Serverless framework ‘serverless deploy’ deploys whatever .jar you have packaged and ready to go within your source project. If you make local code changes but don’t re-build your .jar, serverless thinks you don’t have any changes to deploy: $ serverless deploy … Serverless: Packaging service… Serverless: Service files not changed. Skipping deployment… If you’re …