Support Forums

Bug: if "Base directory" is set and "Publish directory" is left as default, Netlify treats the latter as "Not set" and use root path instead

I have a simple app. No frameworks/libs. It’s all about plain HTML and JavaScript. It’s a monorepo with the following structure:

├── client/
│   ├── index.html
├── server/
│   ├── app.js
│   └── node_modules

I want to serve the files under client/ dir. I believe I have the right Deploy Settings:

  • Base directory: client
  • Build command: not set - empty
  • Publish directory: client/ (set automatically)

When I try to access https://6090975f1416dd4752921c11--lab-pwa-real-estate.netlify.app/, I get a “Page Not Found” error.

When I download the deployed files, I expected to see only the files under client/ dir, but I see the whole project, including client/ and server/ dirs.

It’s as if while building the project, it was ignoring my “base directory” and working on the root dir anyway.

There is no package.json or .nvmrc in my client/ dir.

This is the build log:

10:04:26 PM: Build ready to start
10:04:28 PM: build-image version: e4d2dbe4cfec46db257e869258461ded89b75c9b
10:04:28 PM: build-image tag: v3.7.3
10:04:28 PM: buildbot version: ad3fcf6020c7aec15071db43b748eaa0b3f039c5
10:04:28 PM: Building without cache
10:04:28 PM: Starting to prepare the repo for build
10:04:29 PM: No cached dependencies found. Cloning fresh repo
10:04:29 PM: git clone https://github.com/StanleySathler/lab-pwa-real-estate
10:04:30 PM: Preparing Git Reference pull/4/head
10:04:30 PM: Parsing package.json dependencies
10:04:32 PM: No build steps found, continuing to publishing
10:04:32 PM: Starting to deploy site from ''
10:04:32 PM: Creating deploy tree 
10:04:32 PM: Creating deploy upload records
10:04:32 PM: 0 new files to upload
10:04:32 PM: 0 new functions to upload
10:04:32 PM: Starting post processing
10:04:32 PM: Post processing - HTML
10:04:32 PM: Post processing - header rules
10:04:32 PM: Post processing - redirect rules
10:04:32 PM: Post processing done
10:04:32 PM: Finished processing build request in 4.34241873s
10:04:32 PM: Site is live ✨

I see it says Starting to deploy site from ’ ’ which makes me think this is ignoring my Deploy Settings.

So I managed to fix this. I just added a . (dot) to the end of my Publish directory setting. Now my Deploy Settings are:

  • Base directory: client
  • Build command: not set - empty
  • Publish directory: client/. (note the dot at the end)

It seems that if you leave the default Publish directory (which is set based on the base directory), it won’t work, as Netlify will treat it as “Not set” and use the root path.

I believe this is a bug.

Hello @StanleySathler :wave:

Thank you so much for bringing this to our attention as well as circling back and sharing your workaround, we deeply appreciate it! I will take this to the appropriate teams to get their eyes on it.

A member of our team will follow up here should we have more information! I am going to close your duplicate thread so that we can streamline the conversation into one place.

Thank you again!

1 Like

@StanleySathler, I have added this thread to the open Github issue one of our teams has for this. Should this fix be rolled out, a member of the Netlify staff will follow up on this thread to let you know!

Thank you again for bringing this to our attention :slight_smile:

1 Like

Howdy @StanleySathler- we just shipped a fix to this! You can read more about the change over here → Breaking change: Fixing the default publish directory in monorepo configurations