ethanniser / the-beth-stack

An opinionated hypermedia-driven architecture for building web apps
MIT License
838 stars 83 forks source link

"bun run db:push" not working #12

Closed kimdonginsu01 closed 1 year ago

kimdonginsu01 commented 1 year ago

I got this issue when trying to run db:push. Bun: 1.0.2 OS: Ubuntu 20.04

$ bunx drizzle-kit push:sqlite No config path provided, using default path Reading config file '/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/drizzle.config.ts' drizzle-kit: v0.19.13 drizzle-orm: v0.27.2

/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:48441
    return new LibsqlError(e.message, code, e);
           ^

LibsqlError: HRANA_WEBSOCKET_ERROR: unable to verify the first certificate
    at mapHranaError (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:48441:12)
    at #openStream (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:48575:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async HranaClient.execute (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:48474:29)
    at async TursoSqlite.query (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:42938:21)
    at async fromDatabase3 (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:12938:23)
    at async sqlitePushIntrospect (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:51949:19)
    at async Command.<anonymous> (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:53436:31) {
  code: 'HRANA_WEBSOCKET_ERROR',
  [cause]: WebSocketError: unable to verify the first certificate
      at #onSocketError (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:48099:25)
      at _WebSocket.<anonymous> (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:48022:78)
      at callListener (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:45693:18)
      at _WebSocket.onError (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:45647:13)
      at _WebSocket.emit (node:events:514:28)
      at emitErrorAndClose (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:46607:17)
      at ClientRequest.<anonymous> (/home/tuyenhm@aht.local/Desktop/projects/the-beth-stack/node_modules/drizzle-kit/index.cjs:46504:9)
      at ClientRequest.emit (node:events:514:28)
      at TLSSocket.socketErrorListener (node:_http_client:501:9)
      at TLSSocket.emit (node:events:514:28)
}

Node.js v18.17.1 error: "drizzle-kit" exited with code 1 (SIGHUP) error: script "db:push" exited with code 1 (SIGHUP)


Anyone knows how to fix?

lukebrider-woolard-cgi commented 1 year ago

I had a very similar issue where I got 404 errors from the same websocket. I tried working with the Turso devs as others seemed to have similar issues with this exact repo. There were a couple of package updates that seemed to fix the issue for most people, but not me. My workaround was to run the db:push command through npm instead of bun. Then the rest of the app works fine (as the api commands then have a table to refer to). Seems to be a specific issue with pushing via drizzle-kit using bun's sqlite - and might be a network or firewall issue.

ethanniser commented 1 year ago

thank you for the issue

I am 100% focused on the new Beth stack template I'm making as part of the next video coming out in around a week.

If you want the latest immediately you can check it out at ethanniser/beth-big

ethanniser commented 1 year ago

a ton of things have improved in recent versions of the libsql stuff feel free to reopen if you have a problem