This is a copy paste from Vercel Edge Runtime Source Maps not accessible for 3rd party consumption · Issue #10829 · vercel/vercel · GitHub which got closed but I was told to post here.
I don’t have full insights into this on Vercel’s side so some of the following are assumptions.
Context
Third-party tools like Sentry would like to access source maps for a running application so that stack traces for logged errors can be source-mapped.
Problem
Since functions deployed on the Vercel Edge Runtime are bundled in an additional step opaquely, there is no way for any SDKs to pick up the source maps to upload them to third-party services. This will make it impossible to trace the errors back to their original location. Currently stack traces look like this:
Error: Edge Stack Traces
at (vc/edge/function:122:5661)
at (vc/edge/function:125:10587)
at (vc/edge/function:122:5622)
at (vc/edge/function:147:11182)
at (vc/edge/function:147:9157)
at (vc/edge/function:147:11007)
}
Solution brainstorm
- No additional bundling steps after building a Next.js application. (I don’t know if feasible)
- Expose source maps to the runtime via some global variable. (probably would introduce too much memory overhead)
- Expose sourcemaps on a separate service (like S3) behind an auth token. Out of these, this is the approach that makes the most sense.