error While subscribing to raw message from a web api microservice using Dapr
- Dominant language
- C#
- Stars
- 1.2k
- Forks
- 378
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 5
Description
## Ask your question here
Hello,
I am getting below error While subscribing to raw message from a web api microservice (Microservice1) hosted in docker container (Refer the attached diagram)
The error message logged in Docker desktop (Microservice1 sidecar docker container log).
“time="2022-12-02T06:13:56.234572354Z" level=warning msg="retriable error returned from app while processing pub/sub event 3cbeee4d-03dd-47f7-91fe-42fd9fb7df5d, topic: rawDataTestTopic, body: {\"type\":\"https://tools.ietf.org/html/rfc7231#section-6.5.13\",\"title\":\"Unsupported Media Type\",\"status\":415,\"traceId\":\"00-b3cff34b70d01da2c7c58f4da4f1d35b-77f9e3a244d74e32-00\"}. status code returned: 415" app_id=DBAgent instance=12a64ef3bd7d scope=dapr.runtime type=log ver=1.8.4
Publishing to Kafka pub/sub is done using a curl command:
curl -X "POST" http://localhost:3500/v1.0/publish/pubsub/rawDataTestTopic?metadata.rawPayload=true -H "Content-Type: application/json" -d '{"ordernumber": "1234"}'
Program.cs code:
app.MapSubscribeHandler(new Dapr.SubscribeOptions() { EnableRawPayload = true });
Microservice1 subscribe to Kafka topic using below code:
[Topic(DAPR_PUBSUB_NAME, "rawDataTestTopic",true)]
[HttpPost()]
public async Task OnIFMoEvent([FromBody] Root data)
{
string s = data.ToString();
return Ok();
}
…..
public class Root
{
public string ordernumber { get; set; }
}
Please Note:- Both Microservice1 & its side car are running without any error.
If I remove EnableRawPayload configuration => app.MapSubscribeHandler(), [Topic(DAPR_PUBSUB_NAME, "rawDataTestTopic")] & Curl command .. metadata.rawPayload=false
It is Woking fine
I could see an issue related to this at https://github.com/dapr/dotnet-sdk/issues/709 looks like raw data is supported now
Can someone help ? did I miss any configuration ?
Contributor guide
Assessment
This issue has not been assessed yet.