rsnext/test/e2e/fetch-failures-have-good-stack-traces-in-edge-runtime/pages
Gal Schlezinger 35f68bc691
[edge] improve fetch stack traces in edge runtime (#44750)
Right now, when doing the following in an Edge API:

```typescript
export default async () => {
  await fetch("https://hello.world");
};
```

The stack trace generated does not contain the actual line of code that caused the error.
This gives a bad developer experience when working with `next dev`.
This PR fixes that for this specific use case and adds a test to make sure there's no regression.

For `next start`, there's also a small change, that needs to be pushed upstream to `edge-runtime`.
In order to run user code in the Edge Runtime, we call `vm.evaluate(code: string)`. However,
if we embrace the `options` from the signature of `vm.runInContext(code, ctx, options)`, we can
pass in the filename so the stack trace is correct.

## Bug

- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
2023-01-26 10:16:53 +00:00
..
api [edge] improve fetch stack traces in edge runtime (#44750) 2023-01-26 10:16:53 +00:00
index.js [edge] improve fetch stack traces in edge runtime (#44750) 2023-01-26 10:16:53 +00:00