Import Environmental Variables Inside Vercel Settings
Since we are using Environmental Variables inside our app and our app is deployed on Vercel, we need to import all of the Variables to vercel so that our app functionality did not crash and works as expected.
To import environment variables into your Vercel project settings, follow these steps:
-
Log in to Vercel and Select Your Project.
-
Within your project's dashboard, click on the Settings tab.
-
In the left-hand navigation menu under the Settings tab, select Environment Variables.
Now we have two options:
-
Manually add variables one by one
-
Import from file
Since we have large environment variables that are being used accross our app, therefore the easy way is to just import the .env.local file and Vercel will parse and add the variables
-
Click on
Import .envbutton and then locate the location of .env.local file (present in root of your app folder). -
Click on
Savebutton.
After importing Environment Variables, it is necessary to redeploy the app. Because without redeployment, env variables will not work.