nuxt-modules / supabase

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

SUPABASE_URL is missing in .env #241

Open bbaltatu opened 1 year ago

bbaltatu commented 1 year ago

Hi, I try to build files for production by running "npm run build" command . Because I want to send SUPABASE_URL as env variable I don't have an .env file in the moment of building the server. My question is : "How can I build my app and passing SUPABASE_URL when I run the APP?" (I tried a lot of things and nothing worked.

Using NUXT3 latest @nuxtjs/supabase: 1.0.2

Aietes commented 1 year ago

You don't need an env when building the server, only when running it. How you configure your environment depends on your server setup. How and where are you running your production server?

bbaltatu commented 1 year ago

The build is as "node-server" (default option) and I am running the the server with "node .output/server/index.mjs

Aietes commented 1 year ago

For local testing, if you want to set an environment variable for a single command in the shell (without permanently adding it to your profile or session), you can do it inline, before the command:

SUPABASE_URL=https://yourprojectid.supabase.co SUPABASE_KEY=your_key_here node .output/server/index.mjs

In Windows command prompt:

set VARIABLE_NAME=value && command_to_run

The environment variable will only be set for that single command. It won't affect subsequent commands in the session or other processes. If you need the environment variable in a production environment, you'll probably use PM2 or something.

pascalwengerter commented 3 weeks ago

@Aietes I suppose this issue can be closed? :)

Aietes commented 2 weeks ago

@pascalwengerter Yes, I think so, I hope @bbaltatu got things working. :)