getsentry/sentry-capacitor

Calling setTag with undefined value causes the SDK to throw

vincentbrison opened this issue · 2 comments

Environment

sentry/capacitor 0.17.0, on iOS

Steps to Reproduce

Calling Sentry.setTag("someKey", undefined) causes the error {"message":"Error deserializing tag","errorMessage":"Error deserializing tag"}, which itself is reported to Sentry. Maybe the native part is not handling undefined correctly?

Expected Result

It should not report any error, as calling setTag with an undefined value should only unset the tag if any.

Actual Result

Throwing the error {"message":"Error deserializing tag","errorMessage":"Error deserializing tag"}

Hi and thank you for reporing this issue!

When setting undefined, are you trying to remove the tag "someKey"?

Not necessarily, our app is setting a wide range of tags and depending the usage, certain tags might be undefined. So our current work around is to not set undefined tags, but looking at the doc it still looks like an issue.