Skip to content

sentry-sdk skipes None parameters in request #567

@sergei-iurchenko

Description

@sergei-iurchenko

In my django app I have view which accepts 3 parameters in POST request: login, password, device_id.
If code in view crashes somewhere while processing I see only 2 parameters in sentry (body&curl).
Bug is caused to serialisation issue with None values.
Example curl without bug (device_id is not None):

curl -v -X POST -H "Accept: application/json" --data "{\"username\":\"000\",\"password\":\"qwerty\",\"device_id\":\"iphone\"}" "http://my_host/api/auth/login/"

in sentry I see:
{ device_id: iphone, password: [Filtered], username: 000 }

Example curl with bug (device_id is None):
curl -v -X POST -H "Accept: application/json" --data "{\"username\":\"000\",\"password\":\"qwerty\",\"device_id\":null}" "http://my_host/api/auth/login/"

My code has crashed.
In sentry I see:

{ password: [Filtered], username: 000 }

but I actually have sent 3 parameters in body!

Expected behaviour in sentry:
{ device_id: None, password: [Filtered], username: 000 }

Merge request 566

Several tests fail in my MR because None values appeared in assertion statements, but MR fixes problem with body parameters.
So I have a question to contributors: should I fix all tests to add None values or I did something wrong in my MR and None values are expected to be skiped for some reasons.
As I see in failed tests many None values are really useless but in my case they are necessary. Also there is no separation in serialisation code between this cases (serialising of body params and some others).
I need your advice to complete my MR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    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