-
Notifications
You must be signed in to change notification settings - Fork 20
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
TypeError in Neon Serverless Connector: Cannot Read Properties of Null (Reading 'send') #131
Comments
Thanks for opening an issue. I'll take a look at this. |
@jawj What do you think of my PR? |
Sorry @rkacenski, I will get to this, but it may take another week or two. |
@jawj Coming up on 2 months since I opened this. Is this covered in the recent refactor? When can we expect this? Thanks |
Didn't mean to close this sorry |
Sorry for the delay. The big refactor is now merged. I can see how this issue could happen on Cloudflare (where opening a WebSocket is async) if Drizzle is trying to communicate with the DB even before you issue a query. So I've tried to add a test to pick this up, but so far I haven't managed to reproduce it. Can you provide a minimal reproduction so I can be sure it's addressed? I'm currently doing this in the request function and it seems there's no problem: import { drizzle } from 'drizzle-orm/neon-serverless';
const client = new Client({ connectionString: DATABASE_URL });
const db = drizzle(client);
await client.connect(); // same result with or without this
// do nothing
ctx.waitUntil(client.end()); // same result with plain `await`
return new Response('{ "result": "OK" }', { headers: { 'Content-Type': 'application/json' } }); |
Steps to reproduce
Expected result
The connection should close gracefully, even if no data is sent over the WebSocket.
Actual result
The following error is thrown:
Uncaught TypeError: Cannot read properties of null (reading 'send')
It happens when the WebSocket connection is closed before buffered data can be sent.
Environment
Logs, links
Relevant error log:
Code snippet where the issue occurs:
serverless/shims/net/index.ts
Line 504 in da779b2
Potential Fix
The text was updated successfully, but these errors were encountered: