apteryxxyz / next-ws

Add support for WebSockets in Next.js app directory.
https://npmjs.com/next-ws
131 stars 9 forks source link

Support for Route Groups. #2

Closed i-tengfei closed 1 year ago

i-tengfei commented 1 year ago

"next-ws is a really great library and I'm using it to implement Apollo Server subscriptions. However, when I use it within Route Groups, I encounter the following error:"

/app/(api)/graphql/route.ts

- ready [next-ws] websocket server started successfully
- error unhandledRejection: PageNotFoundError: Cannot find module for page: /graphql/route
    at findPagePathData (/node_modules/next/dist/server/dev/on-demand-entry-handler.js:304:15)
    at async Object.ensurePage (/node_modules/next/dist/server/dev/on-demand-entry-handler.js:476:38)
    at async Server.<anonymous> (/node_modules/next-ws/server/hook.js:37:9) {
  code: 'ENOENT'
}
apteryxxyz commented 1 year ago

👋 I'll look into it, do some testing and see if I can get route groups to work.

apteryxxyz commented 1 year ago

Good news, I just found a fix for this issue, I'll implement it, test it, then publish.

apteryxxyz commented 1 year ago

I've just published next-ws@0.2.2, which should now fix this issue.