You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extra_data: dictionary of params to include with the message. 'body' is reserved.
the body key in the extra_data kwarg is "reserved". I discovered the hard way that, if you happen to pass a dict with a body key, the message you intended to report is replaced with that raw JSON. This was quite difficult to track down, as the behavior did not communicate the "reserved"ness of body - nor is it mentioned in the documentation; only in the docstring.
I'd like to request that this reserved key be changed to something that's harder to accidentally collide with - or at least for pyrollbar to raise an exception or print a warning or something letting me know what I did.
The text was updated successfully, but these errors were encountered:
brettdh
changed the title
"body" being reserved leads to surprising behavior
In rollbar.report_message's extra_data kwarg, "body" being reserved leads to surprising behavior
Mar 14, 2019
We could change the API format so that the reserved 'body' field has a different name, i.e. '$body', or we could move it to a different part of the payload
We could have extra_data go in a nested dict, i.e. data['body']['message']['extra'] instead of merging it into data['body']['message']
We could rename the extra_data['body'] key so it doesn't override the reserved body
After typing this out, (2) seems like the best way to go. The downside of that is that it would make the key a bit longer when it appears in the rollbar UI, but that seems like an OK compromise to avoid the nasty in-band signaling problem we have right now.
Per this comment on
rollbar.report_message
:pyrollbar/rollbar/__init__.py
Line 427 in 33ef2e7
body
key in theextra_data
kwarg is "reserved". I discovered the hard way that, if you happen to pass a dict with abody
key, the message you intended to report is replaced with that raw JSON. This was quite difficult to track down, as the behavior did not communicate the "reserved"ness ofbody
- nor is it mentioned in the documentation; only in the docstring.I'd like to request that this reserved key be changed to something that's harder to accidentally collide with - or at least for pyrollbar to raise an exception or print a warning or something letting me know what I did.
The text was updated successfully, but these errors were encountered: