HP9005 (http-error) means the document response for the route had an HTTP
error status, 400 or above, such as a 404 or a 500. The page may still hydrate,
but it is probably not the page you meant to test. Make the route return a
success status, or list the status in the route's expected statuses.
| Code | HP9005 |
|---|---|
| Name | http-error |
| Default severity | Error |
| Group | Test run problems |
| What it means | The document response had an HTTP error status. |
What the HP9005 http error finding means
hydration-proof checks the status of the document the browser received:
The server answered 500 for http://localhost:3000/products/42.It is an error unless the status is listed in the route's expectStatus. The
page is still tested, so a custom 404 page that hydrates with a mismatch is
reported as well.
Likely causes
- A dynamic route tested with an example value that does not exist, for
example a product id from
routes.dynamicthat is not in the test database. - A server error on this route: check the server logs.
- A signed-in page that answers 401 or 403 to a guest scenario.
- An error page on purpose, such as a route for your 404 page.
How to fix it
Make the route return a success status, or list the status in the route's expected statuses.
- For a server error, fix the route; the server logs have the stack trace.
- For missing data, use example values that exist, or seed them in
hooks.setup. - For signed-in pages, test them in a scenario that signs in (see scenarios).
- For a page that should answer with an error, set
expectStatus:
import { defineConfig } from "hydration-proof";
export default defineConfig({
routes: {
paths: ["/", "/pricing", { path: "/404-page", expectStatus: [404] }],
},
});For Next.js, routes.notFound already loads a URL that does not exist and
expects a 404, to check that the not-found page hydrates. Routes
lists every route option.