Closed spences10 closed 9 months ago
Ok, so, I have found a way around this via a comment on the Prisma issues: https://github.com/prisma/prisma/issues/5030#issuecomment-1398076317
I need to require the @libsql/client
import { AUTH_TOKEN, DB_URL, SYNC_URL } from '$env/static/private';
import type { Client } from '@libsql/client';
import { createRequire } from 'module';
const require = createRequire(import.meta.url ?? __filename);
const {
createClient: RequiredCreateClient,
} = require('@libsql/client');
let client_instance: Client | null = null;
export const turso_client = (): Client => {
if (!client_instance) {
This builds without the __dirname
in the pnpm run build
output from SvelteKit.
It look me an extremely long time to find where this was coming from because of https://github.com/tursodatabase/libsql-js/pull/72, but I managed to track it down:
Looks like this issue is a duplicate of https://github.com/tursodatabase/libsql-js/issues/49
For prosperity if anyone come up against this, referenced in https://github.com/tursodatabase/libsql-js/issues/49
Install the @libslq/client
as a dependency
and not a devDependency
then rollup will take care of the rest
I'm trying to deploy a Turso client with a embedded replica in a SvelteKit app.
exporting the client:
The post install script will run on the platform:
postinstall.ts
This will log out the local and the sync db data fine.
svelte.config.js
:vite.config.ts
:Platform errors:
Same sort of errors on fly.io