netlify / netlify/cli

netlify deploy --build --prod runs with dev context

Open
#5,875 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
1.9k
Forks
474
Avg merge
23h 30m
Merged PRs (30d)
53

Description

Describe the bug

Hello, i think that when i run deploy command with --prod context should be production ?
Or context depends on git branch, etc?

ps:
I know that i can pass --context

Steps to reproduce
  1. create new branch ex: feature/netlify
  2. run netlify deploy --build --prod
Configuration

[build]
command = "npm run export && cp ./netlify-headers/_dev-headers ./out/_headers"
publish = "out"

[[headers]]
for = "/*"
[headers.values]
X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff"
Referrer-Policy = "no-referrer-when-downgrade"
Content-Security-Policy = "default-src 'self' http: https: ws: wss: data: blob: 'unsafe-inline'; frame-ancestors 'self';"
Permissions-Policy = "interest-cohort=()"
Strict-Transport-Security = "max-age=31536000; includeSubDomains; preload"

[context.production]
command = "npm run export"

Environment

System:
OS: macOS 13.4.1
CPU: (10) arm64 Apple M1 Pro
Memory: 790.27 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.18.0/bin/yarn
npm: 9.3.1 - ~/.nvm/versions/node/v16.18.0/bin/npm
pnpm: 7.27.0 - ~/.nvm/versions/node/v16.18.0/bin/pnpm
npmPackages:
netlify-cli: ^15.9.0 => 15.9.0
npmGlobalPackages:
netlify-cli: 15.9.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing netlify deploy --build --prod with the shown [context.production] configuration and compare the selected build context with --context. Use the deploy command's context-selection entry point and its existing tests, if present; done means --prod consistently selects the production command rather than the dev context.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.