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

[BUG]: PGLiteWorker does not work #2873

Open
lightsofapollo opened this issue Aug 28, 2024 · 2 comments
Open

[BUG]: PGLiteWorker does not work #2873

lightsofapollo opened this issue Aug 28, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@lightsofapollo
Copy link

lightsofapollo commented Aug 28, 2024

What version of drizzle-orm are you using?

0.33.0

What version of drizzle-kit are you using?

None

Describe the Bug

Cannot instantiate a drizzle pglite based instance with PGLiteWorker. This seems to be due to a structured cloning error.

This is caused by trying to send the functions over the broadcast channel here

this.rawQueryConfig = {
rowMode: 'object',
parsers: {
[types.TIMESTAMP]: (value) => value,
[types.TIMESTAMPTZ]: (value) => value,
[types.INTERVAL]: (value) => value,
[types.DATE]: (value) => value,
},
};
this.queryConfig = {
rowMode: 'array',
parsers: {
[types.TIMESTAMP]: (value) => value,
[types.TIMESTAMPTZ]: (value) => value,
[types.INTERVAL]: (value) => value,
[types.DATE]: (value) => value,
},
};
.

Once I removed those functions it works fine.

If there's interest in fixing this I'd be happy to submit a quick PR for either just removing those lines or having a separate implementation for the worker type.

Expected behavior

PGLiteWorker (multi tab instance) should work as well as the in memory PGLiteWorker (

Environment & setup

No response

@lightsofapollo lightsofapollo added the bug Something isn't working label Aug 28, 2024
@deep93333
Copy link

I'm having the same issue

@whilestevego
Copy link

I had started the process of writing a patch for this, but had the foresight to check https://github.com/electric-sql/pglite. Turns out they're aware of the issue, and have already fixed it in v0.2.6 with electric-sql/pglite@ef57e10.

I can confirm that it works in my project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants