#Sentry: Shape for BeforeBreadcrumb hint

4 messages · Page 1 of 1 (latest)

boreal nymph
#

Hi! I noticed our codebase developed a bug, and I believe it's because the shape of the hint sent to beforeBreadcrumb( ) changed. I understand that the hint is a pretty loose shape

export interface BreadcrumbHint {
  [key: string]: any;
}

However, in the past I noticed that for "fetch" hints, the hint had a input property , and the input was an array. the second item in the input array were the headers for the fetch request, and the headers were an array.
After some console.logging, it looks like this is no longer the case and headers is an object now.

Are there docs or source code where I can verify this? thanks!

worthy flame
#

Hi, the API is very loose on the hint in beforeBreadcrumb. Right now this is semi-intentional since we use it internally in the SDK but we don't have any near-term plans to improve this. For now I would recommend to either be very careful when accessing anything on the hint, or not rely on it at all.

boreal nymph
#

Gotcha! I am careful, and I have everything wrapped as a try/catch... is there a better way to fetch the headers that were included in the request?

boreal nymph
#

Additionally, I just noticed that when I do see the headers, it seems to be a subset of the headers from the actual request... is there a way to get all the headers?