Skip to content

api.external_url config field is always overridden #3118

Description

@toBeOfUse

Describe the bug
In theory, the api.external_url config.toml field allows the user to tell a Supabase instance what URL its API will be accessible at when it's created. This URL should be used as the base by Supabase Auth endpoints like "POST /admin/generate_link", which needs to use the base URL in the URLs it generates.

However, in practice, the value supplied for external_url in config.toml is always overwritten by the following code:

cli/pkg/config/config.go

Lines 547 to 556 in 9142412

// Update external api url
apiUrl := url.URL{Host: net.JoinHostPort(c.Hostname,
strconv.FormatUint(uint64(c.Api.Port), 10),
)}
if c.Api.Tls.Enabled {
apiUrl.Scheme = "https"
} else {
apiUrl.Scheme = "http"
}
c.Api.ExternalUrl = apiUrl.String()

To Reproduce
Steps to reproduce the behavior:

  1. Supply an external_url string under the [api] section in config.toml.
  2. Start a new Supabase instance with supabase start.
  3. Generate a link through the Supabase Auth API.
  4. The link will start with 127.0.0.1, in spite of whatever you supplied as the external_url.

Expected behavior
I expect the generated link to start with the external_url I supplied.

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

There is no specific failing command, only a failure to use the config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions