invalid environment variables
Hey all.
I'm using
create t3 app
but having some difficulties with custom environment variables.
The .env
type safe code is messing me up.
I am trying to add NEXT_PUBLIC_CLIENT_INVITE_URL
to my .env
file, I have added this env to my schema.mjs
file:
However, I still get an error which I am unsure how to fix. I'm not sure what else I need to add?
My .env
looks like:
18 Replies
Dumb question, are both the schema and .env saved? š
Yep they are, and I have reran
yarn dev
and my .env is also savedAnd that var isn't just an empty string right
correct, it has contents. It is a url
example:
š¤ I'm perplexed
me too! š
It seems like its the server env erroring
Sometimes a database_url won't satisfy zod url
If it's something like postgresql://
hmm. My database env is:
Yeah remove the url condition and that should fix it
Oh wait nvm my project actually is working with that, I'm thinking of using sqlite
Nope! Unfortunately still the same.
NEXTAUTH_URL is a valid url?
Are you by chance trying to use server env in a client area?
Not that I know of. I'm trying to use
env.NEXT_PUBLIC_CLIENT_INVITE_URL
in a component. But this is a client env as far as I know.
ill try comment this out see if that resolves it.
Alright yea, that resolves it.Make sure its being imported from client
š
Thanks! That fixes it. Sorry for that mistake š
Np, sorry for my scatter brain lmao
Np. I appreciate the help š
You have saved me many hours