Giter VIP home page Giter VIP logo

aws-lambda-java-libs's Introduction

AWS Lambda Java Support Libraries

Key libraries for running Java on the AWS Lambda platform.

For issues and questions, you can start with our FAQ and the AWS questions and answer site re:Post

To get started writing Lambda functions in Java, check out the official developer guide.

For information on how to optimize your functions watch the re:Invent talk Optimize your Java application on AWS Lambda.

Core Java Lambda interfaces - aws-lambda-java-core

This package defines the Lambda Context object as well as interfaces that Lambda accepts.

Example request handler

public class Handler implements RequestHandler<Map<String, String>, String>{
 @Override
 public String handleRequest(Map<String, String> event, Context context) {

 }
}

Example request stream handler

public class HandlerStream implements RequestStreamHandler {
  @Override
  public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {

  }
}
<dependency>
 <groupId>com.amazonaws</groupId>
 <artifactId>aws-lambda-java-core</artifactId>
 <version>1.2.3</version>
</dependency>

Java objects of Lambda event sources - aws-lambda-java-events

This package defines event sources that Lambda natively accepts. See the documentation for a list of currently supported event sources. Using this library you can have Java objects which represent event sources.

For example an SQS event:

import com.amazonaws.services.lambda.runtime.events.SQSEvent;

public class SqsHandler implements RequestHandler<SQSEvent, String> {

 @Override
 public String handleRequest(SQSEvent event, Context context) {

 }
}
<dependency>
 <groupId>com.amazonaws</groupId>
 <artifactId>aws-lambda-java-events</artifactId>
 <version>3.11.6</version>
</dependency>

Java Lambda JUnit Support - aws-lambda-java-tests

This package provides utils to ease Lambda Java testing. It uses the same Lambda serialisation logic and aws-lambda-java-events to inject events in your JUnit tests.

@ParameterizedTest
@Event(value = "sqs/sqs_event.json", type = SQSEvent.class)
public void testInjectSQSEvent(SQSEvent event) {
        ...
}
<dependency>
  <groupId>com.amazonaws</groupId>
  <artifactId>aws-lambda-java-tests</artifactId>
  <version>1.1.1</version>
  <scope>test</scope>
</dependency>

aws-lambda-java-events-sdk-transformer

This package provides helper classes/methods to use alongside aws-lambda-java-events in order to transform Lambda input event model objects into SDK-compatible output model objects. See the documentation for more information.

<dependency>
 <groupId>com.amazonaws</groupId>
 <artifactId>aws-lambda-java-events-sdk-transformer</artifactId>
 <version>3.1.0</version>
</dependency>

Java Lambda Log4J2 support - aws-lambda-java-log4j2

This package defines the Lambda adapter to use with Log4J version 2. See the README or the official documentation for information on how to use the adapter.

<dependency>
 <groupId>com.amazonaws</groupId>
 <artifactId>aws-lambda-java-log4j2</artifactId>
 <version>1.6.0</version>
</dependency>

Java implementation of the Runtime Interface Client API - aws-lambda-java-runtime-interface-client

This package defines the Lambda Java Runtime Interface Client package, a Lambda Runtime component that starts the runtime and interacts with the Runtime API - i.e., it calls the API for invocation events, starts the function code, calls the API to return the response. The purpose of this package is to allow developers to deploy their applications in Lambda under the form of Container Images. See the README for information on how to use the library.

<dependency>
 <groupId>com.amazonaws</groupId>
 <artifactId>aws-lambda-java-runtime-interface-client</artifactId>
 <version>2.5.0</version>
</dependency>

Java Lambda provided serialization support - aws-lambda-java-serialization

This package defines the Lambda serialization logic using in the aws-lambda-java-runtime-client library. It has no current standalone usage.

<dependency>
 <groupId>com.amazonaws</groupId>
 <artifactId>aws-lambda-java-serialization</artifactId>
 <version>1.1.5</version>
</dependency>

Disclaimer of use

Each of the supplied packages should be used without modification. Removing dependencies, adding conflicting dependencies, or selectively including classes from the packages can result in unexpected behavior.

aws-lambda-java-libs's People

Contributors

alexaiss avatar andclt avatar anton-stepanof avatar asuresh8 avatar avanathan avatar bmoffatt avatar bradleylyman avatar carlzogh avatar cayua avatar dependabot[bot] avatar dtorok avatar github-actions[bot] avatar gxstv avatar hyandell avatar jccarrillo avatar jeromevdl avatar keshayad avatar msailes avatar muellerc avatar prajesh1 avatar render3d avatar richarddd avatar senioroman4uk avatar smirnoal avatar stefanbotez avatar sukanyahanumanthu avatar tolledo avatar vinayaksood avatar zabrip avatar zsombor-balogh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-lambda-java-libs's Issues

No Event for CodePipeline

Are CodePipeline events supported for AWS Lambda? When calling a Lambda function from CodePipeline, we were unable to define a CodePipelineEvent ourself that would work. There are also no examples to be found on the internet.

Release notes?

Hello there,

just found out there is a new version of aws-lambda-java-core: 1.2.0.

Unfortunately I was missing a release tag and some release notes. Only the commit 36747fc has the information what was changed. Maybe we can have some kind of release notes and tagging?

We don't want to brake things while upgrading to a new version. A short info what was changed would definitely help.

keep up the good work!

kind regards
Björn

log4j2: AWSRequestId set in ThreadContext map, incorrect for multithreaded applications

If I include a %X in my pattern layout, I see that the following appears in my log output

... { AWSRequestId=4e145840-092b-11e8-a601-a9957c1b507d}...

I don't see anything in this library that sets ThreadContext, so I am unsure if this is somehow being set by the Lambda runtime or by some other log4j2 mechanism I am not aware of.

While this value appears to be correct in the main thread, I have noticed that other threads such as in a fork join pool will have this value populated, but often incorrectly (in the case of container re-use, it will retain the value of a previous invocation/request Id). Usually some of the threads have correct IDs while others have stale/old/incorrect IDs: I think the behavior is the request ID is set once the first time the thread is used in a container, but after the thread has been spawned the request ID in the child threads never get updated again, so they retain the request ID of whatever invocation was the first to use/spawn that particular thread.

What library/entity owns setting this request ID and how can I get this to be correct for multi-threaded applications?

NoSuchMethodError while local testing lambda handler

I get the following error:

java.lang.NoSuchMethodError: com.amazonaws.services.lambda.runtime.LambdaLogger.log([B)V at com.amazonaws.services.lambda.runtime.log4j2.LambdaAppender.append(LambdaAppender.java:74) at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156) at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129) at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120) at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84) at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:448) at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:433) at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417) at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:403) at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63) at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146) at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2091) at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2011) at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1884) at org.apache.logging.log4j.spi.AbstractLogger.info(AbstractLogger.java:1426)

How can this be fixed?

Please add support for EU-WEST-2 (London) region

Hi there

Trying to configure eu-west-2 as an destination for a new Lambda connection gives an enumeration error as the region is not defined in the Regions() class.

That would be greatly appreciated :)

Thanks

Andre

Support for Multi-Value Headers and Query String Parameters

API Gateway supports multiple headers and query string parameters that have the same name. Multi-value headers as well as single-value headers and parameters can be combined in the same requests and responses. For more information, see Input Format of a Lambda Function for Proxy Integration and Output Format of a Lambda Function for Proxy Integration.

https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#apigateway-multivalue-headers-and-parameters

A potentially (very) interesting feature: Context.getNumberOfRetries()

Hi,

After doing some research on the internet, it seems that a few Lambda-java users (including me) are worried about the fact that there is no way to control its behaviour when an exception is raised, especially when Kinesis or DynamoDB streams are specified as triggers. Apparently, these streams last for 24 hours and a problematic code is doomed to be executed by lambda again and again during this whole period. Please correct me if I am wrong about that (some posts talk about a "context.succeed" trick but they seem to be speaking NodeJS or Python and I prefer Java).

To my view, a "simple" solution would be to have access to the number of times that a Lambda function has been executed again as a retry (After an exception...): some sort of Context.getNumberOfRetries(). This would easily make it possible for developers to implement behaviours like "Don't try to execute again after an exception", or "You can perform 3 retrials and then forget about it, it is problematic and it won't work, you will just keep billing me for no reason...".

Please let me know what you think.

Regards,

Stop using version ranges for dependencies

I think it is generally bad practice to use version ranges (in this project's case open ended one) for dependencies as it triggers build tools to keep going back to the repository to look for a more recent version.

My project recently broke because of this as a new version of the AWS libraries came out on Friday that removed the json.org library. Since we also use the lambda-java-events library, builds started immediately consuming it. Can you lock down the dependency to a specific version?

SNSEvent doesn't work properly

SNS Event doesn't appear to be parsed correctly, and as a result is unusable. As best I can tell, it is the result of incorrect case, as the "Records" and "records" are mismatched. Lambda parsing is opaque, so I'm not exactly sure how it's used, but when I define my own version of SNSEvent, things work fine.

Add Support for API Gateway Proxy events for WebSocket API

the event for API Gateway Proxy events for WebSocket API has different format of the requestContext. Please, add support for these events as well.

{
    "requestContext": {
        "routeKey": "$default",
        "messageId": "Ti89OAAt3vcAAAQ=",
        "eventType": "MESSAGE",
        "extendedRequestId": "Ti89OF32joEFbiA=",
        "requestTime": "15/Jan/2019:13:09:27 +0000",
        "messageDirection": "IN",
        "stage": "test",
        "connectedAt": 1547557733712,
        "requestTimeEpoch": 1547557767850,
        "identity": {
            "sourceIp": "89.24.55.85"
        },
        "requestId": "Ti89OF32joEFbiA=",
        "domainName": "jzla12ar9e.execute-api.eu-west-1.amazonaws.com",
        "connectionId": "Ti835f_GEowCETQ=",
        "apiId": "jzla12ar9e"
    },
    "body": "hello",
    "isBase64Encoded": false
}

CVE-2015-3373 registered against aws-lambda-java-core-1.2.0.jar

When I run a CVE scan of my java Lambda function, I'm notified that CVE-2015-3373 is registered against aws-lambda-java-core-1.2.0.jar. Also, aws-lambda-java-core-1.2.0.jar has a dependency upon com.fasterxml.jackson.core:jackson-databind:2.6.7.1 for which there is another CVE registered against. I excluded jackson-databind and seperately added the jackson-databind:2.9.4.

You can find out more about CVE-2015-3373 at:
https://web.nvd.nist.gov/view/vuln/search-results?adv_search=true&cves=on&cpe_version=cpe%3A%2Fa%3Aamazon_aws_project%3Aamazon_aws%3A7.x-1.2%3A%3A%7E%7E%7Edrupal%7E%7E

When might we expect a version of aws-lambda-core that does not contain CVE issues?

NoSuchMethodError when using together with latest AWS SDK (1.11.461)

Versions:

  • aws-lambda-java-events: 2.2.4
  • aws-lambda-java-core: 1.2.0

Code:

AWSKMSClientBuilder.defaultClient();

Error:

"errorMessage": "com.amazonaws.client.AwsSyncClientParams.getAdvancedConfig()Lcom/amazonaws/client/builder/AdvancedConfig;",
"errorType": "java.lang.NoSuchMethodError",
"stackTrace": [
  "com.amazonaws.services.kms.AWSKMSClient.<init>(AWSKMSClient.java:454)",
  "com.amazonaws.services.kms.AWSKMSClient.<init>(AWSKMSClient.java:438)",
  "com.amazonaws.services.kms.AWSKMSClientBuilder.build(AWSKMSClientBuilder.java:61)",
  "com.amazonaws.services.kms.AWSKMSClientBuilder.build(AWSKMSClientBuilder.java:27)",
  "com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)",
  "com.amazonaws.services.kms.AWSKMSClientBuilder.defaultClient(AWSKMSClientBuilder.java:45)",
  ...
]

Note: Current workaround is to stay on 1.11.163 for AWS SDK

Questions for java greengrass lambda coding

Dear all,

I'm beginner of greengrass core application, and finished the demo setup following greengrass developper guide. but i'm still confusing about how lambda functio works.the bellow is the quesitons I want to ask for help.

I want to run a lambda function in my raspberry pi 3 as greengrass core, which can recieve multiple IoT devices' MQTT messages and do some process according to task tpye(i.e various signal filtering or house-hold machine learning algorithms). After proceesing, I need send the information using MQTT to my own server(not AWS IoT cloud) for higher level processing with some topics.

my questions are as follows( I want to use JAVA language):
1 To receive multiple aws iot devices connected to the GGC, should I need to set up a AWSIoTMQTTClient in aws-iot-device-sdk-java?
I also find in aws_greengrass_core_sdk_java, there is “IotDataClient” class,what's it for?and what's the different with AWSIoTMQTTClient. here is really very confusing, even with sdk document description.

2 In GGC, when I deployed my lambda function, will it has an internal MQTT broker to receive messages for AWSIoTMQTTClient ?

3 for lambda functions, after creation and deployment on GGC, will it start to work. I saw there is method to invoke another lambda funciton from a lambda funciton. I don't understand the mechanism how lambda works.

4 Can i have multiple lambda functions for different uage,for instance, one is only to receive MQTT messages, another is to process the received info, other one is to send the processed info out to my own MQTT server? if permitted, how to make the work together to perform all the tasks.

5 I saw there is event input to lambda interface, how can I call a lambda only when some specific topic arriverd to AWSIoTMQTTClient defined in the lambda function?

6 the below is JAVA lambda interface template:
outputType handler-name(inputType input, Context context) {
...
}
i think it should permit user to define input data type as he need. but the quesiton is if I define inputtype is string. how to the lambda handler to receive the string. the development guidence have no clear description.

7 finally, can you please share some demo codes for the above questions?

Thanks for you attention and kind help in advance.
your help is highly expected.

APIGatewayProxyRequestEvent does not have authorizer

The APIGatewayProxyRequestEvent requestContext object does not have the authorizer object. With the new addition of the authorizer context, I am unsure how to structure a new Authorizer object.

It is entirely possible to have an authorizer json blob like:

{
    "principalId": "123", // Required by authorizer
    "roles": "role1,role2",  // Additional arbitrary parameter from authorizer context
    "likes_pie": true // Additional arbitrary parameter from authorizer context
}

The principalId is always part of the authorizer blob, and thus should be a String field on a new Authorizer object. However, the additional arbitrary parameters provided by the authorizer context should be a map. This won't (de)serialize 1:1 between JSON and Java however.

CodePipelineEvent

Please consider adding CodePipelineEvent to aws-lambda-java-events.

Make Events derive from a common abstract type

Use case: Create a lambda function that handles different event types

The handler class has to implement the RequestHandler interface with <T,String>, being T one of the event types. As those do not share a common ancestory type, we need to implement the handling of each event type as a separa te class, and hence a separate Lambda. Having a common ancestor type would allow to implement RequestHandler<LambdaEventAbstractType,String> and determine in the handler function the type of event by inspecting its class with event.getClass().
This would also be a more Object oriented design, with a group of closely related types having a common ancestor.
We can now do something similar by implementing RequestHandler<Object,String> but it is poorer design and too loose in terms of type control.

Joda-time as required dependency for REST API implementations with AWS Lambda

Tried excluding Joda-time from a function's implementation for AWS Lambda and got next error:

java.lang.ClassNotFoundException: org.joda.time.DateTime: lambdainternal.util.ReflectUtil$ReflectException
lambdainternal.util.ReflectUtil$ReflectException: java.lang.ClassNotFoundException: org.joda.time.DateTime
Caused by: java.lang.ClassNotFoundException: org.joda.time.DateTime
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)

This required dependency adds extra 0.5 megabytes to the resulting "fat jar". Extra jar size requires reserving more memory for the function to prevent Metaspace issues. But Joda-time itself is not of much use while using Java 8 (and earlier Java versions are not supported in AWS Lambda anyway), so this limitation is unnecessary.

Maybe it's time to get rid of Joda-time? At least in some "next gen" version, for example?

P.S.: Maybe it's a duplicate of #35 , but I just wanted to bring extra reasons to your attention.

aws-lambda-java-events:2.0 missing 'path' in ProxyRequestContext

The class ProxyRequestContext, in lambda API Events is missing the 'path' member.
Attempting to data map a request gives
2017-10-11 07:23:32 ERROR SMSReply:81 - com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "path" (class com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent$ProxyRequestContext), not marked as ignorable (8 known properties: "resourcePath", "apiId", "accountId", "resourceId", "requestId", "stage", "httpMethod", "identity"])

Except from payload:


 "requestContext": {
        "path": "/Prod",
        "accountId": "114709661826",
        "resourceId": "epap6azisg",
        "stage": "Prod",
        "requestId": "12e30354-ae55-11e7-9a45-9d5723258a9f",
        "identity": {
            "cognitoIdentityPoolId": null,
            "accountId": null,
            "cognitoIdentityId": null,
            "caller": null,
            "apiKey": "",
            "sourceIp": "xx.xx.xx.xx",
            "accessKey": null,
            "cognitoAuthenticationType": null,
            "cognitoAuthenticationProvider": null,
            "userArn": null,
            "userAgent": "XX/1.1",
            "user": null
        },


get query string parameters from an API Gateway request

When the lambda is triggered via the API Gateway, is there a way to get the query string parameters from the RequestStreamHandler API?

public class Hello implements RequestStreamHandler {
    public static void handler(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
        // is there any way to get the query string parameters here?
    }
}

Add Support for Lambda Events as Wrappers/Custom Event Body JSON Deserialization

Java Lambda functions support either custom classes or predefined event classes (Lambda events library) as input descriptions used for deserialization.
While custom classes give full control to describe the incoming data, Lambda event classes only define the basic structure of incoming event data. Yet event data can have a body, e.g. SNS messages, which has a custom structure.
Currently, support to describe the body within a event class is not possible and a custom parsing of the String is necessary.

Request:
A change of the lambda event library to allow describing event bodies with Java classes, e.g. through Java Generics, would be beneficial. Please extend the Lambda events library with means to provide Java classes that describe the event's body (or payload).

Omitting the Context object from handler's method signature

Not totally sure is this is the right place to note this documentation issue, but the following sentence can be seen on this page: http://docs.aws.amazon.com/lambda/latest/dg/java-programming-model-handler-types.html

screen shot 2017-04-27 at 3 57 54 pm

When I went to compile my code with the Context object removed from my handler's method signature, I got the following error message:

Can't have an abstract method in a non-abstract class. The class 'MyHandlerClass' must be declared abstract or the method 'java.lang.Object handleRequest(java.lang.Object, com.amazonaws.services.lambda.runtime.Context)' must be implemented.

So I looked at the interface definition here, which confirmed that the Context param is actually not optional.

Just wanted to give you a heads up about this piece of documentation.

Update Log4J2 Version

Log4j2 is currently on version 2.10.0 and this library is still referencing version 2.8.2.

Please update the library.

Could you please lambda saving last deployed url from s3?

Could you please make lambda remeber last deployed url from s3? It is very annoying to copy and paste it every time when I need to redeploy lambda.

image

It is may be out of your scope, but I have no idea where to write this. Amazon it sefl does not have any feature request mechanism (why?), so if this is not of your scope could you please pass it to right place?

AWS SDK has old version of lambda-core.

In order to use Lambda I installed the AWS SDK via the Eclipse update site. This appears to have given me an update-to-date SDK, but with an old version of lambda-core (and different then if I used maven).

My SDK plug-in path for the lamda-core library is:

\plugins\com.amazonaws.eclipse.lambda_1.0.0.v201603160054\lambda-runtime-jar\aws-lambda-java-core-1.0.0.jar

So I've got lambda 1.0.0 and core 1.0.0 (but events v1.1) in my 2016-03-16 plug-in.

Checking maven I see that core was updated to 1.1 on 2015-10-07.

http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.amazonaws%22%20AND%20a%3A%22aws-lambda-java-core%22

I guess this is a problem with the AWS SDK getting updated on the Eclipse update site?

Cannot run lambda function after upgrading aws-lambda-java-events to version 1.1.0

When building against aws-lambda-java-events 1.0.0, my lambda function runs correctly. However, after changing the dependency to 1.1.0, the lambda function fails with a NoClassDefFoundError

Error loading method recordHandler on class Handler: class java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: com/amazonaws/services/lambda/runtime/events/S3Event
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetPublicMethods(Class.java:2902)
    at java.lang.Class.getMethods(Class.java:1615)
Caused by: java.lang.ClassNotFoundException: com.amazonaws.services.lambda.runtime.events.S3Event
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 4 more

I've created a minimal working example that reproduces this problem:
https://github.com/chunyang/lambda-test

The handler Handler::recordHandler runs correctly in lambda-test-1.0.0.jar and does not run correctly in lambda-test-1.1.0.jar

KinesisFirehoseEvent record datatypes ?mismatch?

https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/KinesisFirehoseEvent.java


In the example test payloads/events on the aws Lambda site, the kinesis firehose events use string based timestamps on records, where-as this class seems to use longs:

private Long approximateArrivalEpoch;

private Long approximateArrivalTimestamp;

This means it throws an exception when attempting to deserialize/launch the lambda.

Maybe I'm missing something? or this might need to be tweaked?

aws-lambda-java-log4j2 doesn't support RequestId output

Since AWS Lambda execution environment seems to expect the log4j's MDC class to pass a RequestId, RequestId is not be able to be recorded in CloudWatch if aws-lambda-java-log4j2 is used in a Lambda application.

When I tried aws-lambda-java-log4j2 around August, the following error message appeared in CloudWatch.
Unable to load the log4j's MDC class, customer cannot see RequestId from MDC

Any plan to support RequestId output?

MessageBodyWriter not found for media type=application/json

Hi,
I am using this library : https://github.com/zapr-oss/druidry to send queries to druid.
While on my machine everything works, I am getting this error when trying to run it with lambda

MessageBodyWriter not found for media type=application/json, type=class in.zapr.druid.druidry.query.aggregation.DruidGroupByQuery, genericType=class in.zapr.druid.druidry.query.aggregation.DruidGroupByQuery.

15:41:38
15:41:38.581 [main] ERROR in.zapr.druid.druidry.client.DruidJerseyClient - Exception while querying {}

Any idea what can cause it ?
Thanks,
Tal

RequestStreamHandler returns void

RequestStreamHandler's handleRequest should allow returning an object instead of void. Usecase, uploading a payload and returning it's uid through an endpoint.

Deserialization of ScheduledEvent fails on Joda time during test

I'm geting an exception during an integration test where my Lambda function accepts a ScheduledEvent. When I set a value for "time", I get the following exception:

An error occurred during JSON parsing: java.lang.RuntimeException
java.lang.RuntimeException: An error occurred during JSON parsing
Caused by: java.io.UncheckedIOException: com.fasterxml.jackson.databind.JsonMappingException: java.lang.reflect.InvocationTargetException (through reference chain: com.amazonaws.services.lambda.runtime.events.ScheduledEvent["time"])
Caused by: com.fasterxml.jackson.databind.JsonMappingException: java.lang.reflect.InvocationTargetException (through reference chain: com.amazonaws.services.lambda.runtime.events.ScheduledEvent["time"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:210)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:177)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1474)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:260)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125)
at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1511)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1102)
Caused by: lambdainternal.util.ReflectUtil$ReflectException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
Caused by: java.lang.NullPointerException
at org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral.parseInto(DateTimeFormatterBuilder.java:1224)
at org.joda.time.format.DateTimeFormatterBuilder$Composite.parseInto(DateTimeFormatterBuilder.java:2490)
at org.joda.time.format.InternalParserDateTimeParser.parseInto(InternalParserDateTimeParser.java:52)
at org.joda.time.format.DateTimeFormatterBuilder$MatchingParser.parseInto(DateTimeFormatterBuilder.java:2584)
at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:925)
at org.joda.time.DateTime.parse(DateTime.java:160)
at org.joda.time.DateTime.parse(DateTime.java:149)
... 4 more
`

Add support for Async RequestHandler

Is it possible to add support for Async Request Handler to support async buissnis logic implemented in lambda function.
Currently only sync request handler is available:
aws-lambda-java-libs/aws-lambda-java-core/src/main/java/com/amazonaws/services/lambda/runtime/RequestHandler.java

This has already been requested here:
aws/aws-sdk-java#1164

If needed I would like to contribute to this solution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.