Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSockets connections issues arraybuffer? #77

Open
webdeb opened this issue May 7, 2024 · 3 comments
Open

WebSockets connections issues arraybuffer? #77

webdeb opened this issue May 7, 2024 · 3 comments

Comments

@webdeb
Copy link

webdeb commented May 7, 2024

Hello, I am stumbeling on an periodical error, something like that:

Error ErrorEvent {
  [Symbol(type)]: 'error',
  [Symbol(kTarget)]: WebSocket {
  [Symbol(kEvents)]: SafeMap(4) {
  'error' => <ref *1> {
  size: 1,
  next: Listener {
  next: undefined,
  previous: [Circular *1],
  listener: [Function],
  flags: 0,
  callback: [Function]
}
...
..


},
  [Symbol(ready state)]: 0,
  [Symbol(binary type)]: 'arraybuffer'
},
  [Symbol(kIsBeingDispatched)]: false
}
 ⨯ node_modules/.pnpm/@[email protected]/node_modules/@neondatabase/serverless/index.mjs (1343:0) @ eval

Had to add a console.log to see it actually..

Anyway, seems to be ws related, and wanted to ask, if this is something known, because I found this comment in the codebase:

// import { WebSocket as ws } from 'undici'; // waiting for release of https://github.com/nodejs/undici/pull/2106

It looks like undici already merged the fix, and btw some hours ago they published a new version.
If its not planned to use it immediately, I would like to try it out, should I just link this repo locally and try out?

@jawj
Copy link
Collaborator

jawj commented May 8, 2024

Thanks for your report.

It's a unfortunately opaque error message! If it persists, please let us know what platform you're running this on. A minimal reproduction would also be very helpful.

That particular undici fix was eventually merged a while back, so in principle it should be fine now to use either ws or undici in that file.

Is it possible your issue is down to a recent problem with pnpm?

@webdeb
Copy link
Author

webdeb commented May 8, 2024

@jawj can you give me a brief explanation how to use / build & deploy the package locally? I would be able to track the error more precisely.

The context is the following:

  • Prisma is the main ORM
  • Building it into a cloudflare worker (next-on-pages) Edge runtime
  • Some of the routes are being build as a docker container (next js standalone)

I am using the latest version of the package on npm 0.9.1 (0.9.2 is not deployed btw, if that matters)
Node 20.2.0 (I'll try to switch to 18.20.2)
pnpm 8.6.2

This is how the client is instantiated

import { PrismaClient } from "@/prisma/generated/client";
import { Pool } from "@neondatabase/serverless";
import { PrismaNeon } from "@prisma/adapter-neon";

const pool = new Pool({ connectionString: process.env.POSTGRES_URL });
const adapter = new PrismaNeon(pool);
export const prisma = new PrismaClient({ adapter });

@jawj
Copy link
Collaborator

jawj commented May 9, 2024

OK. Clone https://github.com/neondatabase/serverless and take a look at DEVELOP.md.

After making changes, run npm run export, cd to dist/npm and run npm link.

In another project, run npm link @neondatabase/serverless to use your local version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants