Error when generating SvelteKit tables
When running the
@better-auth/cli generate
command in a SvelteKit project it throws the following error
2025-04-17T14:44:42.264Z ERROR [Better Auth]: [#better-auth]: Couldn't read your auth config. Error: Cannot find module '$env/dynamic/private'
For reference, this is my src/lib/db/index.js
file where the error is thrown:
Thanks in advance!5 Replies
$env/dynamic/private isn't a valid. Are you able to change that to a relative path?
It’s for importing env variables in svelte. So unfortunately no I think
I'm not sure you can do much else about this then.
Maybe we'd have to have custom integration support for this to work? @bekacru
Yeah, to generate the schema I just temporarily moved everything to
auth.js
so it didn't have to import anythingcan you import the variables directly with dynamic i.e:
import {TURSO_DATABASE_URL} from "$env/dynamic/private";
? Then url: TURSO_DATABASE_URL
.
This works for me, but I am using $env/static/private
, not sure if thats different.