oscerd opened a new pull request, #25343:
URL: https://github.com/apache/camel/pull/25343

   # CAMEL-24354: camel-aws2-lambda — `updateFunction` never sent the code 
source
   
   ## Problem
   
   `Lambda2Producer.updateFunction()` built an `UpdateFunctionCodeRequest` that 
only ever carried `functionName` and (optionally) `publish`. In the default 
(non-`pojoRequest`) branch it *validated* that a message body, 
`CamelAwsLambdaS3Bucket`, or `CamelAwsLambdaS3Key` was present — and then 
discarded them. It never called `zipFile(..)`, `s3Bucket(..)`, `s3Key(..)` or 
`s3ObjectVersion(..)` on the builder.
   
   AWS `UpdateFunctionCode` requires exactly one code source (ZipFile, or 
S3Bucket+S3Key, or ImageUri). The request built here had none, so every call 
was rejected with:
   
   ```
   InvalidParameterValueException: Please provide a source for function code.
   ```
   
   The `updateFunction` operation was therefore **unusable** in the default 
mode. (`pojoRequest=true` is unaffected — the caller supplies a complete 
request.) It went unnoticed because no unit test invoked the operation and the 
test mock echoed only the function name.
   
   ## Fix
   
   Assemble the code source on the `UpdateFunctionCodeRequest.Builder` from the 
same headers/body as `createFunction`:
   - `CamelAwsLambdaS3Bucket` → `s3Bucket`
   - `CamelAwsLambdaS3Key` → `s3Key`
   - `CamelAwsLambdaS3ObjectVersion` → `s3ObjectVersion`
   - `CamelAwsLambdaZipFile` (local file path) → `zipFile`
   - message body → `zipFile`
   
   and include the `ZIP_FILE` header in the "no source specified" validation.
   
   Also corrects a copy-paste in `deleteEventSourceMapping()`: the validation 
reads the event source mapping **UUID** header but threw `"Event Source Arn 
must be specified"` — the message now says UUID.
   
   ## Test
   
   Adds `LambdaProducerTest.lambdaUpdateFunctionTest` (the mock now captures 
the `UpdateFunctionCodeRequest`) asserting the request carries the code source 
(`zipFile()` non-null) — it fails against the pre-fix code. Full 
`LambdaProducerTest` green (32 tests).
   
   No public API change, no new dependency. Affects `main` (4.22.0) and the 
4.18.x / 4.14.x lines.
   
   ---
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to