Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env replacement in [auth.sms.twilio] / account_sid #2647

Open
mfazekas opened this issue Aug 30, 2024 · 2 comments
Open

env replacement in [auth.sms.twilio] / account_sid #2647

mfazekas opened this issue Aug 30, 2024 · 2 comments
Labels

Comments

@mfazekas
Copy link

mfazekas commented Aug 30, 2024

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
Copy link
Author

mfazekas commented Aug 30, 2024

Reported at auth repo instead - see supabase/auth#1753

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

cli/pkg/config/config.go

Lines 785 to 798 in 89bc764

if c.Auth.Sms.Twilio.Enabled {
if len(c.Auth.Sms.Twilio.AccountSid) == 0 {
return errors.New("Missing required field in config: auth.sms.twilio.account_sid")
}
if len(c.Auth.Sms.Twilio.MessageServiceSid) == 0 {
return errors.New("Missing required field in config: auth.sms.twilio.message_service_sid")
}
if len(c.Auth.Sms.Twilio.AuthToken) == 0 {
return errors.New("Missing required field in config: auth.sms.twilio.auth_token")
}
if c.Auth.Sms.Twilio.AuthToken, err = maybeLoadEnv(c.Auth.Sms.Twilio.AuthToken); err != nil {
return err
}
}

@fleeser
Copy link

fleeser commented Sep 13, 2024

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

@sweatybridge sweatybridge added this to the P1 milestone Nov 4, 2024
@sweatybridge sweatybridge removed this from the P1 milestone Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants