Commit Graph

7 Commits

Author SHA1 Message Date
Jiachi Liu 93e1a4c71e tests: migrate on-reuqest-error tests to new model (#83383) 2025-09-03 16:47:47 +02:00
Hendrik Liebau 604b87cc28 Increase retry duration for HMR fetch logging tests (#71170)
As we've learned in #70467, compilation times can be quite high in CI,
when testing HMR behaviour. The fetch logging HMR tests are frequently
failing. Increasing the `retry` timeout should mitigate the flakiness.
2024-10-12 02:27:01 +02:00
Jiachi Liu c9daf1fc8c Stablize instrumentation.js (#68853)
### What

- After adding a new API `onRequestError()` and a few fixes on `register()` for `instrumentation.js`, it's time to promote it as stable API.
- Add warning `"experimental.instrumentationHook is no longer needed to be configured in Next.js"` when you configure a `instrumentationHook` option in next.config.js

Related PRs
#67539, #67671, #67703, #67848, #67859, #67856, #67805, #68616, #68672, #68764, #68845 #68976, #68983

Closes NDX-89
2024-08-21 15:55:26 +02:00
Jiachi Liu 11fa91b89f Rename url to path for onRequestError request arg (#68672)
### What

* Rename the `request.url` in onRequestError callback arg to
`request.path`
* Align `routeType: "middleware"` with others, only contain the resource
path in the `request.path`, stripped out request origin.

### Why

For non middleware case, the `req.url` in next-server is actual resource
path, which only contains the pathname and search but without request
origin. For middleware case, the origin is included in the `req.url`.
This might be a implementation detail, but for users, having request
origin here might not be critical and super helpful since they will know
the deployment as a global context for error tracking.

Hence we align the property to a variable that not holding request
origin, given a better naming `request.path`. The idea is from `:path`
request header, which represents the resource path, only containing
pathname and search. e.g. `/a/b?c=2`

x-ref:
https://greenbytes.de/tech/webdav/draft-ietf-httpbis-http2-09.html#HttpRequest
Closes NDX-54
2024-08-12 11:48:49 +02:00
Jiachi Liu e48eb5a2a9 Drop the experimental env var for onRequestError API (#67856)
### What

Since the API is getting more stablized with few past iteration and it's
still under the experimental flag, it's good to ship as a API along with
the `instrumentation.js`
2024-07-17 22:27:14 +02:00
Jiachi Liu b2e711aaea test: add dynamic routes and suspense test case for onRequestError (#67848)
### What

Add tests cases for dynamic routes and suspense page rendering case coverage for onRequestError.

Mostly for checking the `routePath` where we can display the proper original route path

Closes NDX-22
Closes NDX-79
2024-07-17 21:35:17 +02:00
Jiachi Liu f2adcfeb16 Handle server actions error in onRequestError (#67769)
### What

Handling server action errors capturing in instrumentation.js
`onRequestError` API

Closes NDX-21
2024-07-16 20:47:47 +02:00