fix(command-dev): align functions default env variables with production
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 474
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 53
Description
Describe the bug
Related to https://github.com/netlify/cli/pull/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
- Clone the https://github.com/erezrokah/netlify-build-reproductions repo
- Switch to the
pr_2348branch ntl initntl deploy- Invoke the live function
https://cli-pr-2348--<site>.netlify.app/.netlify/functions/index ntl dev- 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/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction steps comparing the deployed function invoked through the Netlify URL with the local function invoked by ntl dev, then review the environment-variable documentation linked in the issue. Done means the built-in environment variables exposed to functions in development match those exposed in production, including the expected handling of URL and DEPLOY_URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100