Closed actraiser closed 4 years ago
@actraiser thanks for the report, I'll check!
@actraiser tried both 2.1.1
and latest
and was able to send the mentioned event successfully. Would it be possible for you to create some small example where it is reproduced?
What I've used:
[
{
"id": "my-service",
"version_data": {
"default": {
"endpoints": [
{
"id": "my-endpoint",
"method": "POST",
"path": "/",
"target": "kafka"
}
]
}
},
"proxy": {
"use_env": true,
"target_url": "API_HOST",
"port": 3000
}
}
]
docker run --name rig -d \
-e PROXY_CONFIG_FILE="$config" \
-e KAFKA_BROKERS="kafka:9092" \
-e PROXY_KAFKA_REQUEST_TOPIC="req-topic" \
-e LOG_LEVEL=debug \
-p 4000:4000 \
--network kafka_default \
accenture/reactive-interaction-gateway:2.2.1
Thanks for checking! I will review my code after the weekend again and let you know how I triggered those crashes.
I actually believe that I made a wrong assumption of the underlying problem in the first place and that those crashes rather happen when using the Kafka-Endpoint in conjunction with an AVRO-Schema.
When encoding fails (because the sent data does not match the schema fetched from the schema-registry), rig seems to crash - but I will go recheck and and provide a reproducable case.
Greets -act
Sorry for the delay - I had to reinstall my environment (thank you Apple) but ever since, I can not reproduce the problem any more. Please consider the issue closed.
Ok, no problem. Feel free to re-open or create new issue if you tackle it again.
Using RIG 2.2.1, when a client sends a request to a RIG Proxy API-Endpoint that should create a Kafka event AND when that request contains a non-string value by either accident or deliberately sent by some bad user, RIG crashes.
Possible solution: when receiving requests on a Kafka-enabled target endpoint, RIG should check that all values are strings and if there is a non-string value, either reject the request or silently toString() all values before forwarding to Kafka.
Example Proxy-Config to accept request to create a Kafka record:
Event including a field containing a number (statusCode)
Sending the event to the configured Proxy Endpoint will immediately crash RIG. If putting the number in quotes, it works fine.