Make a clearer distinction about .env-files for config.toml and Edge Functions. · Issue #4361 · supabase/cli · GitHub
Skip to content

Make a clearer distinction about .env-files for config.toml and Edge Functions. #4361

Open

Description

@KariNarhi28

Link
Using secrets inside config.toml

Local secrets (Edge Functions)

Describe the problem
In those 2 pages there is a mention about .env-file, but there is no indication that they are meant for different usecases and even examples show 2 different locations:

  • /.env (for toml.config).
  • supabase/functions/.env (for Edge Functions).

It's easy to think that there's supposed to be only 1 .env from which the config.toml and Edge Functions load their variables.

Personally I struggled with this for a while, thinking that Supabase docs are wrong and that the .env is supposed to be either in root OR under /supabase/functions and that there are some missing docs about how to load them from the same location.

Describe the improvement
Either add specific notifications that if the .env is in root, it is used for toml.config and if it's under /supabase/functions, it's used only for the Edge Functions.

Or a more preferable solution:
Change the .env-file loading so that there is only 1 .env loaded (from the root) and it's variables are used for both toml.config and Edge Functions.

Additionally, if possible, the default location for the .env could be /supabase/.env and in the config.toml we could toggle (boolean-setting) if the .env should be loaded from the root instead.

For example:

[env]
load_from_root = true

Or maybe specify .env-file location:

[env]
load_from = "<ENV LOCATION HERE>"

Additional context

Here is a picture from my project-folder.

Image

Activity

  1. utopianf commented on Nov 4, 2025

    @utopianf

    I am also very confused that if we still have to setup environment variables via Dashboard after deploying the Edge Function using supabase review CI/CD. Since the only things we can commit safely are .env.preview and .env.production, I think we should have a clean way for supabase Edge Function to read them.

  2. github-actions commented on Jun 26, 2026

    @github-actions
    Contributor

    Hi! Thanks for opening this issue.

    We're closing this because it has not had any activity for 45 days, and we try to keep the Supabase CLI issue tracker focused on reports that are still current.

    If this still reproduces on the latest Supabase CLI, please comment with /reopen on its own line and include your CLI version, updated reproduction steps, and any recent error output. We appreciate the signal and are happy to take another look.

  3. curiosissimoz commented on Oct 5, 2026

    @curiosissimoz

    As described here https://supabase.com/docs/guides/functions/secrets#where-local-values-come-from:

    You can also set local values in config.toml itself, under [edge_runtime.secrets]:

    [edge_runtime.secrets]
    STRIPE_SECRET_KEY = "env(STRIPE_SECRET_KEY)"
    

    In this way, you can have a single .env file (which must be placed at the root of your project).

    But sadly, supabase config push will not push your edge function secrets to your remote production project (you have to do it manually in the dashboard or by running supabase secrets set).

  4. curiosissimoz commented on Oct 5, 2026

    @curiosissimoz

    /reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions