Next.js Discord

Discord Forum

Bun sqlite ?

Answered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
Anyone has some success getting bun:sqlite working with nextjs? Im unable to get it working with this error.Error: Cannot find module 'bun:sqlite' . Ive tried all..
add the types, add it to externals...still no luck 😦
Answered by @ts-ignore
nextjs uses some apis which aren't implemented in bun and hence bun invokes nodejs to run the project
View full answer

12 Replies

Answer
and bun:sqlite doesn't exist in node
Transvaal lionOP
ah i see..
Transvaal lionOP
ok thanks..i guess i need a separate api server..thanks for the info again..
if you want to, you may be able to use --bun to start it with, however i cant recall how nice the nextjs builder is

bun --bun next dev
bun --bun next build
bun --bun next start
Transvaal lionOP
Oh let me try this one
just note if you host on vercel, you cant use bun

also if you want to use node for stability but really want bun sqlite, you can make a "proxy" with fetch and Bun.serve :)
Transvaal lionOP
Yep will be on my own server...
currently i have the sqlite stuff accessed via bun api server instead
yeah nice
Transvaal lionOP
im guessing should be ok as i have them on just within docker via docker compose
@@ts-ignore nextjs uses some apis which aren't implemented in bun and hence bun invokes nodejs to run the project
btw most apis have been added now, just a few nextjs things are buggy now (ie edge runtime works but if you do some specific rare things it doesnt 500s)