RMQ 3.11 with Management Plugin Not Parsing JSON Correctly

603 views
Skip to first unread message

Jason Van Oeveren

unread,
Oct 10, 2022, 8:54:20 AM10/10/22
to rabbitmq-users
I've been using the docker image `rabbitmq:management`, and I think I noticed a bug in the most recent image (3.11.0).
Here's the docker compose file I use:
```
version: "3"

services:
rmq:
image: rabbitmq:management
hostname: "efs"
ports:
- "5671:5671"
- "5672:5672"
- "15672:15672"
volumes:
- ./tst/rmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
```
This is what I have in my conf file:
```
default_vhost = team
default_user = user
default_pass = password
```
This is the command I run to start up the docker image: `docker compose -f docker-compose.yml up --build --force-recreate --abort-on-container-exit rmq`

Here's an example of the curl script I'm attempting to run:

``` bash
curl -u user:password -i \
-H "content-type:application/json" \
-X POST http://localhost:15672/api/exchanges/team/platform/publish \
-d'{
    "properties":{},
    "routing_key":"",
    "payload":"{
        \"type\":\"type\",
        \"action\":\"command\",
    }",
    "payload_encoding":"string"
}'
```
And here's the response I receive from RMQ:
```
HTTP/1.1 400 Bad Request
content-length: 43
content-security-policy: script-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'self'
content-type: application/json
date: Mon, 10 Oct 2022 11:48:04 GMT
server: Cowboy
vary: accept, accept-encoding, origin

{"error":"bad_request","reason":"not_json"}%
```
I was confused by this response because I had used this image for months with the same script and always had success with it.  I was curious if it was an issue with the most recent RMQ image version, so I decided to try the same request again with `rabbitmq:3.10-management`, and I managed to get a successful response back.
```
HTTP/1.1 200 OK
cache-control: no-cache
content-length: 15
content-security-policy: script-src 'self' 'unsafe-eval' 'unsafe-inline'; object-src 'self'
content-type: application/json
date: Mon, 10 Oct 2022 12:31:20 GMT
server: Cowboy
vary: accept, accept-encoding, origin

{"routed":true}%  
```
I'll use the older image for the time being, but I thought I'd bring this to your attention to see if this is a bug that needs to be fixed and whether this should be an issue posted on the GitHub. Thanks!

Michal Kuratczyk

unread,
Oct 12, 2022, 10:27:56 AM10/12/22
to rabbitm...@googlegroups.com
Hi,

We've replaced the JSON parser in 3.11 so things can work differently (but most importantly, they should work faster for large JSON payloads).
Looking at your request, it's not a valid JSON though - there should be no quotes around the payload's value.

Seems like the old parser was less strict, but the new one is not wrong. :)

Best,

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/e138cbdb-94d7-4ce0-bec1-76665d9d3253n%40googlegroups.com.


--
Michał
RabbitMQ team

Jason Van Oeveren

unread,
Oct 12, 2022, 10:47:19 AM10/12/22
to rabbitmq-users
Awesome, thanks for letting me know! I will look at my JSON and adjust accordingly.  
Reply all
Reply to author
Forward
0 new messages