Local call dashboard environment variables
When I use the <environment variable> that I configured in the dashboard in my own project, the following error will appear on the convex terminal, but the strange thing is that my project can use this environment variable normally, and it does not appear on the front end report error
5 Replies
I am using TypeScript, such as code like <process.env.FILE_DEMO_ID as string>. Do I still need to configure the dotenv file locally?
Convex can be successfully deployed when I don't use the environment variable:
Sorry for my negligence just now, the environment variables of this configuration are not loaded into my convex function. So can't get my function to work. I want to know what is the reason for this?
We do no currently make the environment variables available at import time. You will be able to use them when your functions are executed but not in global scope.
thanks @presley solved my dilemma😁
The reason for the error is that I used the <environment variable> in the global top of the convex file by mistake (instead of the defined function)