Unable to run Libsql/Drizzle (Turso) in Remix hosted on Vercel
The last working version I've been able to use is v0.5.2 with Remix + Drizzle (Libsql/Turso) + Vercel. The last time I looked into this, it was an issue with Vercel patching fetch weirdly that caused issues, yet this seems to be an issue now.
My keys are definitely valid as I can connect to Turso using TablePlus, although cannot connect through Vercel.
This is the error that occurs when trying to run a DB query in Vercel:
LibsqlError: SERVER_ERROR: Server returned HTTP status 401
at mapHranaError (file:///var/task/node_modules/@libsql/client/lib-esm/hrana.js:268:16)
at file:///var/task/node_modules/@libsql/client/lib-esm/http.js:76:23
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async LibSQLPreparedQuery.all (file:///var/task/node_modules/drizzle-orm/libsql/session.js:114:18)
at async getSession (file:///var/task/build/server/nodejs-eyJydW50aW1lIjoibm9kZWpzIn0/index.js:923:16)
at async getLoggedInUser (file:///var/task/build/server/nodejs-eyJydW50aW1lIjoibm9kZWpzIn0/index.js:980:19)
at async requireLoggedIn (file:///var/task/build/server/nodejs-eyJydW50aW1lIjoibm9kZWpzIn0/index.js:997:18)
at async loader$h (file:///var/task/build/server/nodejs-eyJydW50aW1lIjoibm9kZWpzIn0/index.js:1785:3)
at async Object.callRouteLoader (/var/task/node_modules/@remix-run/server-runtime/dist/data.js:59:16)
at async /var/task/node_modules/@remix-run/router/dist/router.cjs.js:4724:19 {
code: 'SERVER_ERROR',
rawCode: undefined,
[cause]: HttpServerError: Server returned HTTP status 401
at errorFromResponse (file:///var/task/node_modules/@libsql/hrana-client/lib-esm/http/stream.js:352:16)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
status: 401
}
}
If you need more details / a small repo to reproduce the issue, let me know.
Can You resolved the problem, I had the same error.
[ERROR] LibsqlError: SERVER_ERROR: Server returned HTTP status 401 at mapHranaError (file:///var/task/node_modules/@libsql/client/lib-esm/hrana.js:268:16) at file:///var/task/node_modules/@libsql/client/lib-esm/http.js:76:23 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Module.POST (file:///var/task/dist/server/pages/api/client/newclient.astro.mjs:25:3) at async renderEndpoint (file:///var/task/dist/server/chunks/astro/server_DKKJk_cq.mjs:380:18) at async lastNext (file:///var/task/dist/server/chunks/entrypoint_lKSXzsuD.mjs:1761:23) at async callMiddleware (file:///var/task/dist/server/chunks/entrypoint_lKSXzsuD.mjs:805:10) at async RenderContext.render (file:///var/task/dist/server/chunks/entrypoint_lKSXzsuD.mjs:1805:22) at async NodeApp.render (file:///var/task/dist/server/chunks/entrypoint_lKSXzsuD.mjs:2446:18) at async Server.handler (file:///var/task/dist/server/chunks/entrypoint_lKSXzsuD.mjs:2808:29)
I've got the exact same error as well, any luck on solving this?
LibsqlError: SERVER_ERROR: Server returned HTTP status 401
at mapHranaError (file:///var/task/node_modules/@libsql/client/lib-esm/hrana.js:268:16)
at file:///var/task/node_modules/@libsql/client/lib-esm/http.js:76:23
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async LibSQLPreparedQuery.all (file:///var/task/node_modules/drizzle-orm/libsql/session.js:126:18)
at async DrizzleSessionStorageSQLite.loadSession (/var/task/node_modules/@shopify/shopify-app-session-storage-drizzle/dist/cjs/adapters/drizzle-sqlite.adapter.js:26:25)
at async Object.authenticateAdmin [as admin] (file:///var/task/node_modules/@shopify/shopify-app-remix/dist/esm/server/authenticate/admin/authenticate.mjs:100:19)
at async loader (file:///var/task/build/server/nodejs-eyJydW50aW1lIjoibm9kZWpzIn0/index.js:1205:21)
at async Object.callRouteLoader (/var/task/node_modules/@remix-run/server-runtime/dist/data.js:59:16)
at async /var/task/node_modules/@remix-run/router/dist/router.cjs.js:4726:19
at async callLoaderOrAction (/var/task/node_modules/@remix-run/router/dist/router.cjs.js:4792:16) {
code: 'SERVER_ERROR',
rawCode: undefined,
[cause]: HttpServerError: Server returned HTTP status 401
at errorFromResponse (file:///var/task/node_modules/@libsql/hrana-client/lib-esm/http/stream.js:352:16)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
status: 401
}
}
I've had success using the latest version of @libsql/client and overriding the @libsql/hrana-client to the 0.8.0 version.
My package.json looks like this:
"dependencies": { ... "@libsql/client": "0.14.0", ... }, ... "overrides": { "@libsql/hrana-client": "^0.8.0" },
I've had success using the latest version of @libsql/client and overriding the @libsql/hrana-client to the 0.8.0 version.
My package.json looks like this:
"dependencies": { ... "@libsql/client": "0.14.0", ... }, ... "overrides": { "@libsql/hrana-client": "^0.8.0" },
This also helped with running tests with Astro and Vitest
I've had success using the latest version of @libsql/client and overriding the @libsql/hrana-client to the 0.8.0 version.
My package.json looks like this:
"dependencies": { ... "@libsql/client": "0.14.0", ... }, ... "overrides": { "@libsql/hrana-client": "^0.8.0" },
Still work for "@libsql/client": "^0.15.9",