BETH stack tutorial blocked "Sync is not supported in databases opened in file mode."
After creating a Turso db and adding the needed
.env
variables running bun dev
results in the follwing error.
Nothing is getting served to localhost:3000
but a GET
request to localhost:3001
returns a 404 not found <:honk_thonk:753870955234721821>
I guess I have 2 questions:
1. Why is this command spinning something up on 3001? I've ensured there's nothing running on 3000.
2. It seems like the problem is in the libsql
package within node modules. Not sure if this is related to issue I was having with Bun installing the wrong version of esbuild for my CPU architecture or if that's a coincidence.
Once again, appreciate any thoughts anyone might have.
Thanks!25 Replies
yea I think this one is on me
in ./db/index.ts
wrap the
client.sync
in a if (config.env.DATABASE_CONNECTION_TYPE === 'local-replica'
lmk if that doesnt fix
the 3001 is the live reload server
basically main 3000 server (your app) uses bun hot reload to restart on file changes
3001 livereload server doesnt restart
on restart the 3000 server says "hey 3001 I restarted" then 3001 fowards that to the browser over websocket and tells it to refreshoh that's really interesting
fixed
yeah that if check resolved the error i posted above but the app still doesn't render. it seems like it's not able to find the tables
that's WoT is kinda hard to read, maybe screenshot is easier
bun db:push
returns
uh
are you on remote db
or local
DATABASE_CONNECTION_TYPE="local"
š¤¦āāļø
i'll see myself outuh
can you use this extension and look at the actual sqlite file
https://marketplace.visualstudio.com/items?itemName=qwtel.sqlite-viewer
SQLite Viewer - Visual Studio Marketplace
Extension for Visual Studio Code - SQLite Viewer for VSCode
like it should still work though
DATABASE_CONNECTION_TYPE="local"
-> DATABASE_CONNECTION_TYPE="remote"
the code really shouldnt care about the type
the client api is identical
maybe a drizzle kit thing
but it gets the local client
changing the env variable to
remote
like it is in your video fixed it, the app is running now
happy to use sqlite viewer and look at the sql file if you like thoughyea I mean are the tables there
like drizzle kit push should still push to it
yeah <:honk_thonk:753870955234721821>
yeah they're not there locally
oh you know why
or wait
it could be related to the weird esbuild issue i have, i essnetially have to
npm i
and bun install
to be able to push at allyea im stumped
not sure what the connection could possibly be there but both prolbems touch the same part
I mean that shouldnt matter like the packages should be the same
but the app runs fine though at least on remote
i need my node module to look like that to be able to push the drizzle schema
yes it appears to run on remote, thanks again Ethan
really excited to work through this project