Skip to content

fix(command-dev): align functions default env variables with production #2358

Open
@erezrokah

Description

@erezrokah

Describe the bug

Related to #2348

It seems Netlify Dev passes URL and DEPLOY_URL to functions, but in production we only pass URL.
We'll need to figure out what built-in ones are passed to functions and add those to the CLI.

To Reproduce

  1. Clone the https://github.com/erezrokah/netlify-build-reproductions repo
  2. Switch to the pr_2348 branch
  3. ntl init
  4. ntl deploy
  5. Invoke the live function https://cli-pr-2348--<site>.netlify.app/.netlify/functions/index
  6. ntl dev
  7. Invoke the local function http://localhost:8888/.netlify/functions/index

See that the live function only returns the URL env variable and the local one returns DEPLOY_URL.

  System:
    OS: macOS 11.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 1.00 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.14.0 - ~/.nvm/versions/node/v15.14.0/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 7.11.1 - ~/.nvm/versions/node/v15.14.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  npmGlobalPackages:
    netlify-cli: 3.29.2

Expected behavior

Prod an dev environment should match

Additional context

https://docs.netlify.com/configure-builds/environment-variables/

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