Skip to content

Invalid content type, expected application/json, parseJsonBody.js, symbolicate endpoint #1629

Description

@mlassauzay-pass

Hi !

I just bumped RN from 0.78 to 0.80 and I'm getting this error message triggered in my code when I change screens.

Error: Invalid content type, expected application/json
    at .../node_modules/metro/src/lib/parseJsonBody.js:11:16
   ...

A request is made to the symbolicate endpoint, which attempts to parse the request via parseJsonBody.
parseJsonBody has been modified between 0.78 and 0.80 and only accepts requests with req.headers["content-type"] which contains application/json, but in my case the request it receives contains "text/plain", so it displays this error message. The request content does indeed appear to be JSON, and if I comment out the header validation, the request seems to be processed correctly and I no longer get an error message.

The request trace points to a call to navigate in my code, but I have no further information and navigation works correctly. I tested this with react-navigation 6 and 7.

I'm wondering if anyone else is familiar with this problem, which is causing a lot of error message on the my console ?
I haven't been able to determine if it's a problem with one of my libraries or if parseJsonBody could simply be more permissive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions