Francismiko
Francismiko2y ago

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
No description
5 Replies
Francismiko
FrancismikoOP2y ago
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?
Francismiko
FrancismikoOP2y ago
Convex can be successfully deployed when I don't use the environment variable:
No description
Francismiko
FrancismikoOP2y ago
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?
presley
presley2y ago
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.
Francismiko
FrancismikoOP2y ago
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)

Did you find this page helpful?