PLEASE help us help you by writing a good post!
- site name (preview):
https://deploy-preview-77--staging-safebeachday.netlify.app/
- Build problems? Link or paste the FULL build log & build settings screenshot
I’m trying to use the Netlify CLI to test changes out to some headers locally instead of pushing changes and examining the preview deploy.
It appears that the netlify dev
command is not picking up the build command specified in my netlify.toml
file under the [dev]
config. When I run netlify dev
I’m getting the following error:
Notably, the error seems to suggest that the command being ran is yarn run build:lambda
, however in my netlify.toml
I have specified the following:
[build]
functions = "lambda"
[dev]
command = "yarn develop:localEnv"
My package.json
has the following scripts. Please note that I’m attempting to run the script develop:localEnv
with yarn
:
...
"scripts": {
"develop:localEnv": "yarn dotenv gatsby develop",
"develop:local": "doppler configure set config=development && doppler run gatsby develop",
"develop:staging": "doppler configure set config=staging && doppler run gatsby develop",
"develop:production": "doppler configure set config=production && doppler run gatsby develop",
"develop": "yarn develop:staging",
"build": "gatsby build",
"serve": "doppler run gatsby serve",
"test": "yarn run lint:css && yarn run lint:js && yarn run check-pretty",
"setup": "node ./bin/setup.js",
"lint:js": "eslint --ext .js,.jsx .",
"lint:css": "stylelint 'src/**/*.js'",
"check-pretty": "prettier --list-different {,src/**/}*.{js,jsx,json,css,scss}",
"format": "prettier --write \"src/**/*.js\"",
"clean": "gatsby clean",
"start:lambda": "netlify-lambda serve functions",
"build:lambda": "netlify-lambda build functions",
"prod": "yarn run build; yarn run build:lambda"
},
...
When I run the script in question on its own (simply yarn develop:localEnv
) my gatsby build works just fine. Happy to provide more context, I’m assuming that I’ve made a (hopefully) glaringly obvious error in my configuration…
Might also be worth noting that I am modifying headers via gatsby-plugin-netlify
but aside from the headers, I’ve done no other modification to the netlify config via the plugin.
...
{
resolve: 'gatsby-plugin-netlify',
options: {
headers: {
'/*': [
'X-XSS-Protection: 1; mode=block',
'X-Content-Type-Options: nosniff',
'Referrer-Policy: same-origin',
`Content-Security-Policy:
frame-ancestors *;
`,
],
},
},
},
...