Closed yoieh closed 1 year ago
Thanks for the PR! I can't remember, does the Next.js dev server log something to console when a standard page is requested and it doesn't exist? Just thinking I'd prefer to keep the behaviour as consistent as possible with upstream behaviour.
yarn run v1.22.19
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
warn - You have enabled experimental feature (appDir) in next.config.js.
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
ready - loaded websocket plugin successfully
(node:5483) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
event - compiled client and server successfully in 918 ms (265 modules)
wait - compiling...
event - compiled client and server successfully in 241 ms (265 modules)
wait - compiling /dashboard/page (client and server)...
event - compiled client and server successfully in 667 ms (499 modules)
ready - loaded websocket plugin successfully
error - failed to find page for websocket request: /api/ws
I got no feedback when it was missing. Last error is the one I added.
In that case I shall go ahead and close the PR for now. If the Next.js team add this behaviour or there's some way to cleanly selectively enable it we can re-visit down the road.
ok, right know it's just a bit confusion do to you are not given any feedback it its missing. Any ws request just gets stuck as pending until timeout and you don't understand why.
In that case, it might be better then to add an explicit socket close (potentially with an error message) if it attempts to route to a socket handler that isn't found?
Just used this when i was debugging, might be use full.