You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If examples/custom-server-fastify/server.js is converted to typescript, it exposes a bug in either the next typescript definition for next-server.d.ts or in how server.js is using handleRequest().
Describe the bug
Converting server.js to server.ts reveals a private member access problem on this line: return app.handleRequest(req.req, reply.res).then(() => {
Here's the error: Property 'handleRequest' is private and only accessible within class 'Server'.ts(2341)
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Run the instructions in exmaples/custom-server-fastify to create a new project. Specifically, npx create-next-app --example custom-server-fastify custom-server-fastify-app
Rename server.js to server.ts.
Fix require/import statements:
import Next from 'next'
import fastifyInit from 'fastify'
const fastify = fastifyInit({ logger: { level: 'error' } })
See error mentioned above.
Expected behavior
Code should not try to use private functions, and there should be no serious typescript errors.
System information
Node 12.8.1
Next 9.0.5
The text was updated successfully, but these errors were encountered:
I converted the lines with the errors to this, and it seems to work. Is this the correct/expected usage in next?
OLD: return app.handleRequest(req.req, reply.res).then(() => {
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
vercel
locked as resolved and limited conversation to collaborators
Jan 30, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
If examples/custom-server-fastify/server.js is converted to typescript, it exposes a bug in either the next typescript definition for next-server.d.ts or in how server.js is using handleRequest().
Describe the bug
Converting server.js to server.ts reveals a private member access problem on this line:
return app.handleRequest(req.req, reply.res).then(() => {
Here's the error:
Property 'handleRequest' is private and only accessible within class 'Server'.ts(2341)
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
npx create-next-app --example custom-server-fastify custom-server-fastify-app
Expected behavior
Code should not try to use private functions, and there should be no serious typescript errors.
System information
Node 12.8.1
Next 9.0.5
The text was updated successfully, but these errors were encountered: