Commit graph

2 commits

Author SHA1 Message Date
Hannes Bornö
b3f3bf59b9
Improve app-render error log with edge runtime (#46157)
`app-render` server errors aren't logged correctly with the edge runtime. This adds logging of a filtered stack trace.

Before
![image](https://user-images.githubusercontent.com/25056922/220144922-06aba048-0166-4114-8421-8f61e6137d5e.png)

After
![image](https://user-images.githubusercontent.com/25056922/220145019-83c1cf80-d6c7-4ce0-b76f-201265c7fafb.png)

Still some improvements left to figure out. This change doesn't log the original stack frame, and the `Log.error` is not printed with a red text like it should be.

Fixes NEXT-593

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
2023-02-20 16:24:15 +00:00
Hannes Bornö
1127df4d6a
Make app-render error logging less verbose in dev (#45472)
Make the app-render error less verbose in dev. Reuse
`logErrorWithOriginalStack` from the dev server but hide frames from
`node_modules`, `next/dist/compiled` and `node:internal` if we're in the
app directory. Also removes `webpack-internal` from the frame file name.

<details>
<summary>Before</summary>


![image](https://user-images.githubusercontent.com/25056922/215798020-9aea3401-95dd-4f09-9e4c-26d822c0ce38.png)
</details>

<details>
<summary>After, with source</summary>


![image](https://user-images.githubusercontent.com/25056922/216609074-66039be9-f599-47af-8c5d-b64a6be503ab.png)
</details>

<details>
<summary>After, no source</summary>


![image](https://user-images.githubusercontent.com/25056922/216608526-46ada990-7e6f-4c9e-b1d3-347ebb03f6fa.png)
</details>

<details>
<summary>For comparison, from `pages/`</summary>


![image](https://user-images.githubusercontent.com/25056922/216610761-dd87e5e6-1e9c-4b41-8adf-650cf15464e3.png)
</details>

Fixes NEXT-441

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

---------
2023-02-14 18:46:30 -08:00