0

I am trying to deploy my nuxt site on Netlify, it is deployed But I am facing some issues with environment variables. When I try to log in to the site, it's working correctly & moves to the index page. But when I am trying to search for something on the nuxt app the API fails due to an undefined environment variable even if I am using the same environment variable for the login API call. I am adding the environment variable here.

enter image description here

It's the successful API call with environment variables,

enter image description here

It's the unsuccessful API call with the same environment variables. Its also embedded in the other domain at the start of the API call. enter image description here

kissu
  • 40,416
  • 14
  • 65
  • 133
  • Does it work locally? Which version of Nuxt are you using? Do you have a nuxt config to share? Do you use an `.env` file? Why are your variables named `VUE_APP`? Did you checked that one? https://stackoverflow.com/a/67705541/8816585 – kissu Jan 17 '23 at 10:00
  • @kissu Yes, it works locally fine even on another server. I am using this `nuxt@2.15.8` version. Yes, I am also using the `.env` file. I don't understand that why login API works & others APIs don't work even with the same environment variables on `Netlify`. By the way, I am not accessing the environment variables in `nuxt.config.js`. – Abdullah Zafar Jan 18 '23 at 07:01
  • What do you mean? How are you accessing it? You can also try on Vercel for testing purposes. Why are your variables named `VUE_APP`? – kissu Jan 18 '23 at 07:14

0 Answers0