[
https://issues.apache.org/jira/browse/CAMEL-26033?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-26033 started by Claus Ibsen.
-------------------------------------------
> camel-aws2-lambda - invokeFunction without a body and createFunction with a
> Map body fail with a NullPointerException
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26033
> URL: https://issues.apache.org/jira/browse/CAMEL-26033
> Project: Camel
> Issue Type: Bug
> Components: camel-aws2
> Affects Versions: 4.18.0, 4.22.0, 4.23.0
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of aws2-lambda (CAMEL-24961).
> h4. 1. invokeFunction without a body fails with a NullPointerException
> invokeFunction sends {{SdkBytes.fromString(body as text)}}
> ({{Lambda2Producer}}, main 07d2e7a987bc, lines 307-308), which fails for no
> body with {{NullPointerException: string must not be null.}}, though an
> invoke without input is valid. Checked on 4.24.0-SNAPSHOT with {{camel run}}
> against the AWS emulator of {{camel infra run aws}}.
> *Proposed change*: send no payload, or {{{}}}, when there is no body.
> h4. 2. createFunction and updateFunction fail with a NullPointerException for
> a Map body
> The zip of the code is the body, read as a ByteBuffer ({{Lambda2Producer}},
> line 357). A Map or a POJO has no ByteBuffer, so the call fails with
> {{NullPointerException: byteBuffer must not be null.}}. A body also wins over
> the {{CamelAwsLambdaZipFile}} header, and with the S3 headers both a zip and
> an S3 location are sent. Checked on 4.24.0-SNAPSHOT with {{camel run}}
> against the AWS emulator of {{camel infra run aws}}: a Map body gave the
> NullPointerException; a File, a byte[] and a stream worked, and so did no
> body with the zip file header.
> *Proposed change*: fail with a message that says the body must be the zip as
> bytes, a stream or a file; use the header or S3 when it is set.
> h4. Also read in the code, not run
> * The payload is encoded in the default charset of the JVM, and the payload
> of the response decoded as UTF-8 (lines 308 and 317).
> * An error of the function does not fail the exchange: the body is the JSON
> of the error, with {{CamelAwsLambdaFunctionError}} set. Worth a line in the
> docs.
> * updateFunction takes an S3 bucket without a key or a key without a bucket;
> createFunction needs both.
> * The description of the operation option lists 5 of the 31 operations, and
> the createFunction example of the docs uses the runtime nodejs6.10.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)