nuxt-modules / supabase

Supabase module for Nuxt.
https://supabase.nuxtjs.org
MIT License
733 stars 129 forks source link

Module reads runtimeConfig directly rather than overridden config #348

Open cco3 opened 7 months ago

cco3 commented 7 months ago

Version

@nuxtjs/supabase: 1.1.7 nuxt: 3.11.1

Steps to reproduce

Use NUXT_PUBLIC_SUPABASE_URL and NUXT_PUBLIC_SUPABASE_KEY in your .env file as suggested here: https://supabase.nuxtjs.org/get-started#installation

Include these in your runtime config:

  runtimeConfig: {
    public: {
      supabase: {
        key: "",
        url: "http://127.0.0.1:54321",
      },
    },
  },

What is Expected?

No warnings are given.

What is actually happening?

A warning is given because the key is set to an empty string (even though it is overridden with NUXT_PUBLIC_SUPABASE_KEY.

https://github.com/nuxt-modules/supabase/blob/f3f11aa4642985551c9fd3237f93124482e6a17b/src/module.ts#L148

I would expect the module to allow me to override the value before deciding to give me a warning, but it reads the config directly.