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]: $with is undefined on withReplicas #1834

Open
malonehedges opened this issue Jan 26, 2024 · 4 comments · May be fixed by #1839
Open

[BUG]: $with is undefined on withReplicas #1834

malonehedges opened this issue Jan 26, 2024 · 4 comments · May be fixed by #1839
Labels
bug Something isn't working

Comments

@malonehedges
Copy link

What version of drizzle-orm are you using?

0.29.3

What version of drizzle-kit are you using?

0.20.10

Describe the Bug

const db = withReplicas(primaryDb, [readDb])
const subquery = db.$with('changes').as(db.select().from(users))
// ^ $with is undefined

Expected behavior

$with should work, or the type should be different.

I'm happy to specify if i'm using the primary or a read replica, or construct the query another way if possible.
As-is, the types suggest this works when it doesn't.

Environment & setup

I am using node-postgres as my database.

@malonehedges malonehedges added the bug Something isn't working label Jan 26, 2024
@malonehedges malonehedges linked a pull request Jan 27, 2024 that will close this issue
@malonehedges
Copy link
Author

resolved by #1839

@AndriiSherman
Copy link
Member

@malonehedges thanks a lot! Will merge your PR

@hirbod
Copy link

hirbod commented Mar 19, 2024

@AndriiSherman can you merge this? We patch-packages, but would be nice to resolve this upstream

@nateeo
Copy link

nateeo commented Apr 19, 2024

@malonehedges thanks for raising this, I encountered this issue and you saved me a whole bunch of debugging time <3

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

Successfully merging a pull request may close this issue.

4 participants