-
-
Notifications
You must be signed in to change notification settings - Fork 62
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
3.25.0
Plugin version
7.0.0
Node.js version
16.13.0
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
11.6.1
Description
The plugin uses app.render under the hood, which explicitly disallows rendering _app, _document and _error pages:
Attempting to render the _error path (as described in the readme) results in a 404 Not Found response.
If you need to render with Next.js from within a custom handler (such as an error handler), use
reply.nextRenderapp.setErrorHandler((err, req, reply) => { reply.status(err.statusCode || 500) return reply.nextRender('/_error') })
Steps to Reproduce
See description.
Expected Behavior
The plugin should either:
- Decorate the request with the
appinstance, so thatapp.renderErrorcan be called manually - Decorate fastify with a
reply.nextRenderErrorwhich proxies theapp.renderErrorsimilar to howreply.nextRenderworks
Metadata
Metadata
Assignees
Labels
No labels