cli icon indicating copy to clipboard operation
cli copied to clipboard

env replacement in [auth.sms.twilio] / `account_sid`

Open mfazekas opened this issue 1 year ago • 2 comments

Describe the bug It seems that env(...) is not evaluated in account_sid. Twilio works if it put value directly in account_sid but it doesn't if i try to use and env. env(...) works in auth_token

To Reproduce

Edit your config.toml

[auth.sms.twilio]
enabled = true
account_sid = "env(FOO12)"
message_service_sid = "env(FOO23)"
auth_token = "env(FOO34)"

Start supabase with the referenced variables set:

FOO12=foo12 FOO23=foo23 FOO34=foo34 npx [email protected] start

Inspect variables in docker:

% docker inspect supabase_auth_db |  grep TWILIO
                "GOTRUE_SMS_TWILIO_ACCOUNT_SID=env(FOO12)",
                "GOTRUE_SMS_TWILIO_AUTH_TOKEN=foo34",
                "GOTRUE_SMS_TWILIO_MESSAGE_SERVICE_SID=env(FOO23)",

Expected behavior

% docker inspect supabase_auth_db |  grep TWILIO
                "GOTRUE_SMS_TWILIO_ACCOUNT_SID=foo12",
                "GOTRUE_SMS_TWILIO_AUTH_TOKEN=foo34",
                "GOTRUE_SMS_TWILIO_MESSAGE_SERVICE_SID=foo23",

Screenshots If applicable, add screenshots to help explain your problem.

System information Rerun the failing command with --create-ticket flag.

  • Ticket ID: n/a
  • Version of OS: Darwin mbpm2.t.hu 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64
  • Version of CLI: 1.191.3
  • Version of Docker: Docker version 27.1.1, build 6312585
  • Versions of services:
        SERVICE IMAGE      │      LOCAL       │ LINKED
  ─────────────────────────┼──────────────────┼─────────
    supabase/postgres      │ 15.1.1.78        │ -
    supabase/gotrue        │ v2.158.1         │ -
    postgrest/postgrest    │ v12.2.0          │ -
    supabase/realtime      │ v2.30.23         │ -
    supabase/storage-api   │ v1.10.1          │ -
    supabase/edge-runtime  │ v1.56.1          │ -
    supabase/studio        │ 20240729-ce42139 │ -
    supabase/postgres-meta │ v0.83.2          │ -
    supabase/logflare      │ 1.4.0            │ -
    supabase/supavisor     │ 1.1.56           │ -

Additional context If applicable, add any other context about the problem here.

  • Browser n/a
  • Version of supabase-js n/a
  • Version of Node.js v18.20.2

mfazekas avatar Aug 30 '24 19:08 mfazekas

~Reported at auth repo instead - see https://github.com/supabase/auth/issues/1753~

Nevermind seems to be code in cli that's not doing the env replacement, but only in AuthToken:

https://github.com/supabase/cli/blob/89bc7647ae2ac125346e9bdd4645bb6289797406/pkg/config/config.go#L785-L798

mfazekas avatar Aug 30 '24 19:08 mfazekas

The replacement does not work for auth.hook.send_email.secrets, too.

fleeser avatar Sep 13 '24 02:09 fleeser