selectFrom or getExecutor not a function with custom dialect.

Hello, I am using a custom dialect which was basically forked from here [1] but when I try to run a query with it, I get one of 2 errors depending on how I try to run the query (with selectFrom or with sql.raw().execute(db)): - selectFrom is not a function - executorProvider.getExecutor is not a function I am already using a fork of the main kysely-d1 custom dialect and that works fine. Someone made this patch that uses the Cloudflare API and I want to use that, but I can't see the problem. When I compare the working dialect with the non-working one I don't see a lot of differences outside of how it executes the query. Any ideas on what to look at? [1] https://github.com/aidenwallis/kysely-d1/blob/31d4a9003707a8f276220e7dad24c29658767f04/src/d1-api-dialect.ts
Solution:
OK, nevermind. My function was marked as async but I had moved the async functionality elsewhere so I was trying to query a Promise and typescript didn't catch the issue.
Jump to solution
2 Replies
JustWayne
JustWayneOP3d ago
I confirmed that the Kysely instance has an executor object after creating it. It prints out as typeof object and evaluates to DefaultQueryExecutor {} When I added some logs, I see that Kysely does not even try to acquire a connection before it has an issue so it's something with the query builder that breaks. The selectFrom property of the Kysely instance doesn't even exist when using this dialect. It's so weird.
Solution
JustWayne
JustWayne3d ago
OK, nevermind. My function was marked as async but I had moved the async functionality elsewhere so I was trying to query a Promise and typescript didn't catch the issue.

Did you find this page helpful?