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

   # Description
   
   Fixes [CAMEL-27755](https://issues.apache.org/jira/browse/CAMEL-27755).
   
   ## Summary
   
   Function Compute can answer a function error with the status 200 and the 
X-Fc-Error-Type header. The exchange completed, and no Camel header showed the 
error. invokeFunction now sets the new header CamelAlibabaFcFunctionError to 
the error type, and the exchange still completes.
   
   - `FCHeaders.FUNCTION_ERROR` is the header `CamelAlibabaFcFunctionError`, 
with the label producer.
   - `FCProducer` sets it from `x-fc-error-type`, and removes it for a response 
without an error type.
   - The doc page has a section on how a route detects such a function error.
   
   ### Why the exchange does not fail
   
   camel-aws2-lambda does the same for a failed function, and its 
CamelAwsLambdaFunctionError text says so. The SDK gives the header names in 
lower case, as tea 1.4.3 copies them from `Headers.toMultimap` of OkHttp 4.12.0.
   
   ## Tests
   
   - `InvokeFunctionErrorTest` checks that a function error sets the header and 
does not fail the exchange.
   - It checks that a second call that succeeds removes the header of an 
earlier function error.
   - Both tests failed before the change, as the header was null.
   - The module tests of camel-alibaba-fc ran 19 tests, and CamelCatalogTest 
ran 156 tests, with no failure.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I ran `mvn clean install -Dquickly -DskipTests` in the root folder on 
the parent commit. Then I ran the builds of camel-alibaba-fc, camel-catalog 
with CamelCatalogTest, camel-componentdsl and camel-endpointdsl, and committed 
all generated changes.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   _Claude Code on behalf of saravanakumar1987_
   
   🤖 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