Manual Setup? Cannot run @better-auth/cli generate
This may become a bigger problem down the line as well, I am not sure. I am attempting to go through the initial setup. My app runs on Cloudflare workers, which does not have access to process.env. Instead I must pass the variable to it from a context.
Having this in my auth.ts causes this error when attempting to generate the user tables
I think I would rather create the schema file where I want to anyway. Is the schema we need to create documented anywhere?
12 Replies
Hi did u find a way to solve this? I am facing the same error. Thanks
I didn't end up looking too closely. I'm currently planning on going back to Supabase auth for now
After some consideration I decide to delegate the auth and user management (so only better auth) to a neon instance and the core data application to D1.
It has some cons ofc, no fk with "user_id" and app level logic to handle relations with users.
Dunno if it's the best options (I would like to try out D1), I'll test it for some times
Id love to know how it goes. I also am looking at D1 for cost. I'm just not terribly confident in using it yet as they want smaller and more distributed databases, and right now my design is based on a large, single database.
You're headed the direction I want to go though
you can use .dev.vars file to store the variable
generate types using
then import the env from cloudfare:workers module and use it like
damn i didnt know that, I'll try it out
but wait, this import will work in local only or also in prod? because I previously understood that you could access envs only via the Hono context by doing
const app = new Hono<TYPE>();
where TYPE includes Bindings: CloudflareBindings;
you i need to configure wrangler.jsonc
Cloudflare Docs
Environment variables
You can add environment variables, which are a type of binding, to attach text strings or JSON values to your Worker.
nvm bro, I just said smtng stupid
tysm tho
like this
don't add the vars here which are important. important should be stored in .dev.vars and by running the command you generate the types and use it
heyy appreciate this ty
ok