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
We had a customer reach out about filtering breadcrumbs, so I looked into recommending a beforeNotify snippet to remove unwanted breadcrumbs.
I could not get it to work, as the filtered breadcrumbs would not persist in the final payload. Now, I understand that accessing a field with double underscores (__breadcrumbs) is generally a no-no. Is there a way to do this that I am unaware of?
I pushed up a test in a branch with how I thought it would work:
Hey @rabidpraxis, the reason your approach didn't work is because beforeNotify callbacks act on the notice itself and breadcrumbs are only added to the request payload on a later stage. Your test in the branch didn't work because there is no n.__breadcrumbs variable; breadcrumbs are inside a client.__store variable.
The easiest workaround I can come up right now without introducing any changes would be to call Honeybadger.configure({ breadcrumbsEnabled: false }) to disable breadcrumb collection and then calling it again to enable it: Honeybadger.configure({ breadcrumbsEnabled: true }). Do you know if this would work for them?
In regards to your question about double underscores, it's one of the earlier ways to mark a field as private, but it's up to us whether we want to respect this (i.e. Javascript won't complain). In some occasions, it may be OK if we access these fields internally but we should not encourage their usage as part of the public SDK (i.e. we should not ask people to access it in a beforeNotify handler). I hope that makes sense.
We had a customer reach out about filtering breadcrumbs, so I looked into recommending a
beforeNotify
snippet to remove unwanted breadcrumbs.I could not get it to work, as the filtered breadcrumbs would not persist in the final payload. Now, I understand that accessing a field with double underscores (
__breadcrumbs
) is generally a no-no. Is there a way to do this that I am unaware of?I pushed up a test in a branch with how I thought it would work:
master...filter-breadcrumbs
The text was updated successfully, but these errors were encountered: