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

No matching export in "node_modules/@astrojs/db/dist/runtime/index.js" for import "sql" #1

Closed
hkbertoson opened this issue Mar 18, 2024 · 10 comments

Comments

@hkbertoson
Copy link

node_modules/lucia-adapter-astrodb/dist/index.js:1:9:
   1 │ import { sql } from "@astrojs/db/runtime";

Seems like this is not exported from @astrjojs/db/runtime

@xrexy
Copy link

xrexy commented Mar 19, 2024

Seems like this commit removes exports for both sql and SqliteDB which are imports from drizzle-orm, so a possible fix could be importing from drizzle-orm not @astrojs/db/runtime.

Not sure if it should be fixed in @astrojs/db(or why they even changed it) or if pilcrowOnPaper is fine with the "fix" I mentioned above

@xrexy
Copy link

xrexy commented Mar 19, 2024

Nvm, I'm dumb this PR moves them to /runtime/config.ts

Edit: they have this in their package.json "./dist/runtime/config.js": { "import": "./dist/runtime/config.js" } so not sure if you can even import the config lol

@hkbertoson
Copy link
Author

Yeah im not sure on this. Quite odd

@pilcrowonpaper
Copy link
Owner

I'm not really sure what API to use since eq() etc exported by Drizzle and Astro DB have different types. Drizzle isn't 1.0 yet, so I'd prefer to stick to whatever version Astro DB is using too.

@hkbertoson
Copy link
Author

Sounds like something to talk to the Astro team about.

@theDeal
Copy link

theDeal commented Mar 19, 2024

What is a solution you guys are using rn?

@xrexy
Copy link

xrexy commented Mar 20, 2024

I just went back to @astrojs/db 0.8.6, but wouldn't say that's a solution

@josu-dev
Copy link

josu-dev commented Mar 21, 2024

I just went back to @astrojs/db 0.8.6, but wouldn't say that's a solution

I dont know if its a possible solution but i locally changed my dist file of the adapter to import {sql} form 'astro:db' direclty but it breaks with the bundler i think

@boycott
Copy link

boycott commented Mar 22, 2024

Whats worked for me is to copy the adapter into my lib directory and call it from there, and adapt it as follows:

import { sql } from 'astro:db';

import type { db as SqliteDB } from 'astro:db';
import type { Table } from "@astrojs/db/runtime";

and then use typeof in the private variable and constructor:

private db: typeof SqliteDB;
...
constructor(db: typeof SqliteDB, sessionTable: SessionTable, userTable: UserTable) {
...
}

@pilcrowonpaper
Copy link
Owner

Fixed with 0.0.5 - see the README for configuring your project

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

6 participants