-
Notifications
You must be signed in to change notification settings - Fork 202
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
This was properly working in the previous version of Karavan/Camel. Don't know exactly if the bug will be in Karavan or Camel, but can be moved if needed.
I am making an HTTP request that returns a JWT token (big payload) and this token should be then used for subsequent HTTP requests. I am storing the token in a property to be used later.
When trying to make the request using this token, the requests result in 400 Bad Request as apparently the token has some invalid new line character.
This was properly working in version 4.8.
(Please ignore the Redis part, it is irrelevant for the flow and it is used for other purposes)
- to:
id: get-token
uri: https
parameters:
httpMethod: POST
logHttpActivity: true
httpUri: login.dummy.net/user/connect/token
- setProperty:
id: store-access-token
name: accessToken
expression:
jsonpath:
id: jsonpath-ca8f
expression: $.access_token
- setHeaders:
id: setHeaders-1b59
headers:
- id: setHeader-1864
name: CamelRedis.Key
expression:
simple:
id: simple-0bff
expression: accessToken
- id: setHeader-7795
name: CamelRedis.Value
expression:
simple:
id: simple-9a1c
expression: ${exchangeProperty.accessToken}
- to:
id: to-e8ac
uri: spring-redis
parameters:
host: redis
port: "6379"
- setHeaders:
id: setHeaders-3eb6
headers:
- id: set-content-type
disabled: false
name: Content-Type
expression:
simple:
id: simple-fb9b
expression: application/json
trim: true
- id: setHeader-2c75
name: Authorization
expression:
simple:
id: simple-2048
expression: Bearer ${exchangeProperty.accessToken}
- setBody:
id: setBody-4d7b
expression:
simple:
id: simple-a312
expression: |
{
"events": ["*"],
"ttl": "01:00:00",
"delivery": {
"transport": "webhook",
"uri": "http://test:8081/webhook-handler",
"auth": {
"type": "basic",
"username": "user",
"password": "pass"
}
}
}
- to:
id: call-next-api
uri: https
parameters:
httpMethod: POST
logHttpActivity: true
httpUri: >-
https://api.dummy.services/notifications/v2/accounts/_me/subscriptions
disableStreamCache: false
karavan 4.10.2 breakline error.log
Steps to reproduce the behavior
- Receive a big JWT token from an HTTP Response
- Store the token in a property
- Make another request using this token to authenticate
- Request fails with 400 as the token is invalid.
Please check attached image/logs.
Variant
Web Application
Container Management (if applicable)
None
Operating System (if applicable)
None
Version
4.10.2
Relevant log output
**Error:** "status":400,"errors":{"$":["'0x1F' is an invalid start of a value. (...)
2025-03-20 16:20:53.310 INFO 15 --- [- timer://Start] mponent.http.LoggingHttpActivityListener : Sending HTTP Request (host: api.dummy.services route: unite-subscribe-call-events-source-1 exchangeId: 8C88CB89CC86E86-0000000000000001)
POST /notifications/v2/accounts/_me/subscriptions HTTP/1.1
Authorization: Bearer <token-with-1452-chars-line1>
<token-with-1452-chars-line2>
cf-cache-status: DYNAMIC
CF-RAY: 92368a147ab0c9ab-IAD
Content-Encoding: gzip
Referrer-Policy: no-referrer-when-downgrade
Server: cloudflare
Set-Cookie: [sts-context-id=000c7a38-d351-467d-ab78-15e8da7d8715; path=/user; secure; httponly, ARRAffinity=3183ced78ead332d3b5c1d8d5ee4caee7270593f89ddc312ce212f7fcad77f57;Path=/;Domain=login.dummy.net]
Strict-Transport-Security: max-age=2592000
traceparent: 00-5d3ea246e84679b8cac47faedd6c2126-ee192142b37c7c19-01
X-Correlation-ID: 5d3ea246-e846-79b8-cac4-7faedd6c2126
X-Powered-By: [ASP.NET, ARR/3.0]
Accept-Encoding: gzip, x-gzip, deflate
Host: api.dummy.services
Content-Length: 205
Content-Type: application/json
Connection: keep-alive
User-Agent: Apache-HttpClient/5.4.2 (Java/17.0.14)
{
"events": ["*"],
"ttl": "01:00:00",
"delivery": {
"transport": "webhook",
"uri": "http://test:8081/webhook-handler",
"auth": {
"type": "basic",
"username": "user",
"password": "pass"
}
}
}
2025-03-20 16:20:53.744 INFO 15 --- [- timer://Start] mponent.http.LoggingHttpActivityListener : Received HTTP Response (host: api.dummy.services route: unite-subscribe-call-events-source-1 exchangeId: 8C88CB89CC86E86-0000000000000001 elapsed: 433ms)
HTTP/1.1 400 Bad Request
Date: Thu, 20 Mar 2025 16:20:53 GMT
Content-Type: application/problem+json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
x-correlation-id: 8a05e63e-0f0b-44d0-83da-98ac75e97734
X-Powered-By: ARR/3.0,ASP.NET
cf-cache-status: DYNAMIC
Server: cloudflare
CF-RAY: 92368a193b206fbf-IAD
{"type":"https://tools.ietf.org/html/rfc9110#section-15.5.1","title":"One or more validation errors occurred.","status":400,"errors":{"$":["'0x1F' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0."],"request":["The request field is required."]},"traceId":"00-5d3ea246e84679b8cac47faedd6c2126-50d0e2a8b7c02338-01"}
2025-03-20 16:20:53.764 ERROR 15 --- [- timer://Start] ocessor.errorhandler.DefaultErrorHandler : Failed delivery for (MessageId: 8C88CB89CC86E86-0000000000000001 on ExchangeId: 8C88CB89CC86E86-0000000000000001). Exhausted after delivery attempt: 1 caught: org.apache.camel.http.base.HttpOperationFailedException: HTTP operation failed invoking https://api.dummy.services/notifications/v2/accounts/_me/subscriptions with statusCode: 400Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
