We’ve upgraded to 16.0.1
netlify-cli version and our
netlify publish command started to fail in CI because it is resolving the
dist folder from the monorepo root, not from the package folder, where the
netlify deploy command is run.
Folder structure of our repo:
/ - root of the repo, NOT the root of UI monorepo
/services/ui-app/ - UI monorepo root
/services/ui-app/packages/app - UI app we are building and deploying
/services/ui-app/packages/app/netlify.toml - only netlify config file we have
/services/ui-app/packages/app/dist - folder to be deployed (generated on
npm run build command run)
Our one and only netlify.toml file:
[build] publish = "dist" command = "npm run build"
What was working for us before (paraphrasing and omitting steps here):
$: cd services/ui-app/packages/app $: npx netlify deploy
All required env variables are set for GH CI envioronment.
After upgrade to 16.0.1
deploy command returns an error that
dist folder is not found:
Deploy path: .../services/ui-app/dist Configuration path: .../services/ui-app/packages/app/netlify.toml Error: No such directory .../services/ui-app/dist! Did you forget to run a build?
You can see that toml file is resolved correctly, but deploy path is resolved relatively to the UI monorepo root (/services/ui-app), even though command itslef is run from the corresponding package (
app) folder - is this expected?
We found out about the
filter argument, and tried that one (as
--filter app or
--filter packages/app or
--filter @ourScope/app, while running command from the
app package folder as well as from UI monorepo root folder, but nothing worked for us - dist folder is not resolved correctly and sometimes netlify.toml file is not resolved as well (when command is run from the monorepo root folder).
My assumption is that the case where UI monorepo root is NOT the same as git repo root hasn’t been tested. And that’s the not-so-common bucket we fall into.
At the moment we’ve fixed it by
publish = "packages/app/dist" and adding
--filter app flag to our
netlify deploy command (however not sure if that one makes a difference).