supabase icon indicating copy to clipboard operation
supabase copied to clipboard

WARN Missing supabase ***, set it either in nuxt.config.js or via env variable

Open sdr0x07b6 opened this issue 2 years ago • 11 comments

I am using @nuxtjs/supabase and this package expects the .env file in the project root directory to define SUPABASE_URL and SUPABASE_KEY.

However, since my project defines different environment variables for the production and staging environments, I put the respective .env files together in the env/ directory as a management method, and there is no .env file in the project root directory.

Therefore, I get the following warning.

WARN  Missing supabase url, set it either in nuxt.config.js or via env variable                              
WARN  Missing supabase anon key, set it either in nuxt.config.js or via env variable

It seems that you can define it in nuxt.config file, but I don't think you can define it in nuxt.config file because SUPABASE_URL and SUPABASE_KEY are different in each environment.

The use of @nuxtjs/supabase itself is working fine. However, the warning points out that "the definitions of SUPABASE_URL and SUPABASE_KEY do not physically exist in the .env , file in the project root or in the nuxt.config file," and I don't think that resolving the environment variables to be loaded at run-time will fix the display.

What can I do to avoid the warning?

sdr0x07b6 avatar Oct 22 '23 15:10 sdr0x07b6

I am having the same warning, but with the variables in the .env file in the project root. They do not seem to be showing up. It seems like none of the env vars are coming through.

BusinessOfTechnology avatar Oct 28 '23 22:10 BusinessOfTechnology

I have encountered the same problem, i've created the env file but the warning persiste.

DAOUD-Nadjem-eddine avatar Nov 08 '23 15:11 DAOUD-Nadjem-eddine

Same. If I use .env.local file I get the 2 warns:

WARN Missing supabase url, set it either in nuxt.config.js or via env variable WARN Missing supabase anon key, set it either in nuxt.config.js or via env variable

but if I use .env file warn about url disappears, but about anon key is still here:

WARN Missing supabase anon key, set it either in nuxt.config.js or via env variable

upd. solved. this helps: *ENVs that Supabase described in docs: SUPABASE_ANON_KEY *ENVs that the Supabase Nuxt Module uses: SUPABASE_KEY

also make sure that the values ​​are wrapped in quotes ": SUPABASE_URL="https://yoursupabaseurlhere.com/" SUPABASE_KEY="yourkeyhere"

Alex-L3 avatar Dec 16 '23 20:12 Alex-L3

In our case, we generate the app once and use it for the production and staging environments. The .env values are freezed at build time and we can't change them at deploy time (since it's only a static payload).

For other settings we use this workaround: the deploy step injects a public/conf.json the app can fetch to get specific environments values. But we did not find how to feed those values to nuxt/supabase instead of the env variables.

PhE avatar Mar 22 '24 14:03 PhE

Apologies if I'm necroing this thread. For anyone who Googles this like I did - I found by surrounding the variables with double quotes and using a .env file instead of .env.local resolved on my end. My nuxt.config.ts file looks like this:

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: true },
  modules: ["@nuxtjs/supabase"],
  supabase: {
    url: process.env.SUPABASE_URL,
    key: process.env.SUPABASE_KEY,
    redirect: false,
  }
})

robinslange avatar May 26 '24 03:05 robinslange

I see, so I decided to give it a try. I thought.... Now I see that there are no warnings already? Maybe @nuxtjs/supabase has been improved somehow?

sdr0x07b6 avatar May 26 '24 04:05 sdr0x07b6

After hours of debugging i noticed my vscode wasnt on auto save, it was a secondary pc

Bukharee avatar Aug 17 '24 08:08 Bukharee