PeanutDumplings
Xata issues with environment variables in NestJS
I have a simple NestJS app, generated through their cli, and have attempted to add Xata to the project to use as my database. I've ran the
xata init
command, and everything generated correctly and my environment variables were added to my .env
file. However, where I try to run my app with pnpm start:dev
(a precreated script) I get this error:
This is my KeyCache.ts
file:
My environment variables are working fine as in the root file (main.ts
) I have the following code:
and the appropriate variable is outputted near the start of the logs (before the errors).
Does anyone know what might be causing this error? Could it be the way in which files are loaded in NestJS, meaning that the KeyCache file that requires xata be loaded before environment variables are set/available to the app?
Thanks in advance :)5 replies