

‘serverless invoke local’ with Java Lambdas
source link: https://www.kevinhooke.com/2021/07/02/serverless-invoke-local-with-java-lambdas/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

‘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. com.serverless.ApiGatewayResponse@3bd3d05e
Any other logger output will appear in your console, but in order to see the actual content of your ApiGatewayResponse, add a toString() method as the message suggests.
You include any of the properties in ApiGatewayResponse, but if you’re just interested in the JSON payload in the body of the response, then just adding this will return the body:
public String toString(){ return this.body; }
CategoriesTech NotesTagsaws, aws lambda, java, serverless
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
Comment
Name *
Email *
Website
Save my name, email, and website in this browser for the next time I comment.
Notify me of follow-up comments by email.
Notify me of new posts by email.
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Post navigation
Recommend
-
80
In this post, we look at how we enable Pulumi to build and deploy serverless functions in AWS, Azure, or GCP using lambda functions in JavaScript and TypeScript.
-
20
深入理解Java反射中的invoke方法 九月 15, 2019 0 条评论 什么是反射 反射(Reflection)是Java程序开发语言的特征之一,它允许运行...
-
9
AWS Lambda errors with Java Lambdas and Serverless framework Using a basic Servlerless framework event config like this: functions: hello: handler: kh.javalambda.HelloLambda::myHandler events: - http: ...
-
6
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 d...
-
12
Java Reflection Invoke Static Method This article will look at how we can use Java Reflection API to invoke a Static method. We will see the steps and the explanation with code. Let us first have a quick look...
-
6
Serverless Framework: AWS Lambdas with scheduled events and parameters To configure an AWS Lambda to get triggered by a CloudWatch event, you can use the ‘schedule’ event in your config: functions: your-functio...
-
5
Deploying changes to individual Lambdas using Serverless Framework I have a serverless project that deploys 2 Lambdas in the same stack: service: example-apis2 provider: name: aws memorySize: 512 region: u...
-
10
Using Serverless Framework to build and deploy Docker images for AWS Lambdas AWS Lambdas can be packaged and deployed using a Docker image, described in the docs
-
10
Serverless framework: passing query parameters to ‘serverless invoke’ If you’re using ‘serverless invoke’ to call deployed Lambdas, you can pass params to the Lambda with the –data option :
-
12
.NET 6 Lambdas on ARM64 - Part 2, ServerlessDownload full source code.This is...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK