How to test HelloWorldLambda

6 posts / 0 new
Last post
How to test HelloWorldLambda

Test event is expecting json and throwing parsing error.we cant pass only name as it is not valid json

{"key":"name"}

This is throwing 

{
  "errorMessage": "An error occurred during JSON parsing",
  "errorType": "java.lang.RuntimeException",
  "stackTrace": [],
  "cause": {
    "errorMessage": "com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: lambdainternal.util.NativeMemoryAsInputStream@710726a3; line: 1, column: 1]",
    "errorType": "java.io.UncheckedIOException",
    "stackTrace": [],
    "cause": {
      "errorMessage": "Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: lambdainternal.util.NativeMemoryAsInputStream@710726a3; line: 1, column: 1]",
      "errorType": "com.fasterxml.jackson.databind.JsonMappingException",
      "stackTrace": [
        "com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)",
        "com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:857)",
        "com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:62)",
        "com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11)",
        "com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1511)",
        "com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1102)"
      ]
    }
  }
}

Recipe name and the step

Can you please let me know, in which recipe and step, you got this error?

More Details

his error i got while testing first receipe only. i.e Your First AWS Lambda

6. We can test the uploaded JAR:
1. Select Configure test events from the Select a test
event dropdown next to the Test button.
2. Select Create new test event.
3. Give a name for the event: MyHelloWorldTest.
4. Within the JSON request content area, just specify your name, such
as Heartin.
5. Click on Create. If successful, it will take you to the
myHelloWorldLambda function page.
6. From the myHelloWorldLambda function page, select the test event,
MyHelloWorldTest, next to the Test button, and click the Test button.
7. You should see the message Hello Heartin after expanding the
details of execution result.

 

One more point , where awscli gets installed , aws command is not working on windows , i can see i need to add path  but not able to see folder under users

Solution

4th step in the recipe is

"Within the JSON request content area, just specify your name, such as Heartin". 

So you have to add only your name in the content area of the configured test event. For example : "Rajni"

Add your name in the above format. Save the test event and click 'Test' on the main page and you will see the output

Working

Thanks its working , I was trying to give name as {"test"} but as you mentioned it should be with brackets.

aws path is working

I have added "C:\Users\<username>\AppData\Roaming\Python\Python35\Scripts" path in path environment variable ,after that aws command started working.

After running aws configure , i can see .aws folder is created under "C:\Users\<username>" path

Contact

We learn together, do innovations and then document them.

Offline Contact
We connect physically only in Bengaluru currently, but most of our activities happen online. Please follow us here or in social media for more details.
WhatsApp (Primary): (+91) 7411174113
WhatsApp (Secondary): (+91) 7411174114

Business newsletter

Complete the form below, and we'll send you an e-mail every now and again with all the latest news.

About Cloudericks

Team Cloudericks is a community to learn about and master cloud computing. Current learning focus is on AWS cloud.

We believe that knowledge is useless unless you share it; the more you share, the more you learn. Visit Cloudericks.

Recent comments

Photo Stream