supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
949 stars 178 forks source link

OAuth provider environment variables should be ignored in Github Actions #1807

Open Aero56 opened 6 months ago

Aero56 commented 6 months ago

Bug report

Describe the bug

I have Google enabled as external OAuth provider for local development setting the client id and secret with environment variables.

I also have a github actions workflow to deploy to production. The problem is that this calls supabase link which expects these environment variables to be set, but these cannot be used in github actions.

> Run supabase link --project-ref $SUPABASE_PROJECT_ID
Error evaluating "env(GOOGLE_AUTH_CLIENT_ID)": environment variable GOOGLE_AUTH_CLIENT_ID is unset.

To Reproduce

[auth.external.google]
enabled = true
client_id = "env(GOOGLE_AUTH_CLIENT_ID)"
secret = "env(GOOGLE_AUTH_SECRET)"

Expected behavior

Supabase commands shouldn't care about these environment variables in config.toml because they are only used for local development.

System information

obroomhall commented 6 months ago

I evaded this error by setting spoof environment variables in the action, where each environment variable I needed was set to a single whitespace character. This obviously makes for an incorrect config, but since I was only pushing migrations this didn't matter.

ianschmitz commented 5 months ago

Agreed this threw me for a loop too. I had started thinking that maybe it was sync'ing these configuration values to the remote supabase instance, but that doesn't make sense for the supabase link command.

It seems to me that this should only matter while doing something like supabase start for starting up the containers locally.

alexander-densley commented 1 month ago

@obroomhall how did you set that env variable? is it a reposiroty secret on github?

obroomhall commented 1 month ago

@alexander-densley I would recommend reading the documentation on GitHub Actions environment variables, which gives various examples on how to provide environment variables, e.g.

name: Greeting on variable day

on:
  workflow_dispatch

env:
  DAY_OF_WEEK: Monday

jobs:
  greeting_job:
    runs-on: ubuntu-latest
    env:
      Greeting: Hello
    steps:
      - name: "Say Hello Mona it's Monday"
        run: echo "$Greeting $First_Name. Today is $DAY_OF_WEEK!"
        env:
          First_Name: Mona