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
The problem: often times file names in the source map are artificial, e.g. webpack://[name]/packages/client/src/layout/ModalPageLayout.tsx. If the source map contains only line/column numbers and not the source code per se, then stacktrace-gps runs a separate XHR request to fetch such artificial files and of course fails. (Even if filenames are not artificial, it's unlikely that anyone will have source code files in production at all.)
A solution could be to have an option to turn off function name resolution if this resolution implies a network request. It sounds similar to offline:true, but it's actually not: with offline:true, even the *.map file won't be fetched, whilst for this particular issue, we need to fetch *.map and not to fetch individual source files.
I have a work-around for this though, but it's ugly:
const stackFrames = await StackTrace.fromError(error, {
// StackTract d.ts file is stale, it doesn't include ajax() hook
// supported by stacktrace-gps library, but we can use it actually.
ajax: async (location: string, opts: any) =>
location.startsWith("webpack://")
? ""
: fetch(location, opts).then(async (res) =>
res.status === 200 ? res.text() : ""
),
} as any);
The text was updated successfully, but these errors were encountered:
The problem: often times file names in the source map are artificial, e.g.
webpack://[name]/packages/client/src/layout/ModalPageLayout.tsx
. If the source map contains only line/column numbers and not the source code per se, then stacktrace-gps runs a separate XHR request to fetch such artificial files and of course fails. (Even if filenames are not artificial, it's unlikely that anyone will have source code files in production at all.)A solution could be to have an option to turn off function name resolution if this resolution implies a network request. It sounds similar to
offline:true
, but it's actually not: withoffline:true
, even the *.map file won't be fetched, whilst for this particular issue, we need to fetch *.map and not to fetch individual source files.I have a work-around for this though, but it's ugly:
The text was updated successfully, but these errors were encountered: