Skip to content

Bad jSON measure is retuning 500 error (instead of 40X ?) #863

@AlvaroVega

Description

@AlvaroVega

IoT Agent JSON version the issue has been seen with

3.X

Bound or port used (API interaction)

Southbound (Devices data API)

NGSI version

NGSIv2

Are you running a container?

Yes, I am using a contaner (Docker, Kubernetes...)

Image type

normal

Expected behaviour you didn't see

curl -i -X POST 'http://localhost:7897/iot/json?i=dev1&k=APIKEY' -d '{"badjson: 51}' -H 'content-type: application/json'

Unexpected behaviour you saw

HTTP/1.1 500 Internal Server Error
X-Powered-By: Express
X-Processing-Time: 0
Content-Type: application/json; charset=utf-8
Content-Length: 63
ETag: W/"3f-wl0eCXDLmqPu8kwb0n1HWMhsjFo"
Date: Fri, 14 Feb 2025 09:27:55 GMT
Connection: keep-alive
Keep-Alive: timeout=5

{"name":"SyntaxError","message":"Unexpected end of JSON input"}

Steps to reproduce the problem

No response

Configs

environment:
    - "IOTA_CB_HOST=orion"
    - "IOTA_CB_PORT=1026"
    - "IOTA_NORTH_PORT=4041"
    - "IOTA_REGISTRY_TYPE=mongodb"
    - "IOTA_MONGO_HOST=mongodb"
    - "IOTA_MONGO_PORT=27017"
    - "IOTA_MONGO_DB=iotagent-json"
    - "IOTA_HTTP_PORT=7896"
    - "IOTA_PROVIDER_URL=http://iot-agent:4041"

Log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions