When I start supabase locally and run pnpm supabase status -o env I get a nice collection of env vars, like
ANON_KEY="eyJ...CJ9.eyJpc3......MTI5OTZ9.CRXP1A7WOeo....I0"
API_URL="http://127.0.0.1:54321"
DB_URL="postgresql://postgres:[email protected]:54322/postgres"
GRAPHQL_URL="http://127.0.0.1:54321/graphql/v1"
INBUCKET_URL="http://127.0.0.1:54324"
JWT_SECRET="secret-jwt-token-secret-jwt-token"
SERVICE_ROLE_KEY="eyJhb....VCJ9.eyJ...k5Nn0.EGIM96....81IU"
STUDIO_URL="http://127.0.0.1:54323"
I would like the SERVICE_ROLE_KEY for running some tests. I want direct access to the local database to manipulate db data, and the createClient from package "@supabase/supabase-js" requires the key.
I wrote a shell script to take the output of supabase status -o env to add to my env to run my tests locally. I want to run the same thing in github actions. I can get a "local" supabase started in the github action steps with uses: supabase/setup-cli@v1 or pnpm i and run supabase db start and supabase db reset.
However when I run pnpm supabase status -o env as a github actions step I don't get the service role key or other values. I just get
DB_URL="***127.0.0.1:54322/postgres"
How can I get the SERVICE_ROLE_KEY for my tests in github actions?
I've tried using supabase CLI as mentioned above, also tried not using supabase/setup-cli@v1 and instead running supabase commands via pnpm once dependencies installed, which made no difference. I've tried running the script immediately after supabase starts by chaining it with && (in case something was shutting down unintentionally) but no success. I updated supabase version to 1.150.0 which is up-to-date. I originally suspected my script for copying the supabase status variables somewhere the code can pick them up, but after using cat to see the file, or adding a step to run supabase status in github actions, the values are obviously not there.
Additionally, I may be going mad but I think it has randomly has worked once or twice.