Publishing new builds does not respect the base directory

We haven’t changed anything wrt our site configuration of build/deployment settings, but all new deployments result in “Page Not Found” errors. For example:

https://5ed12b2013e8280006a6bd12--salad-website.netlify.app

Our project lives in a sub-directory called “main-site” in the Git repository. If you add that to the preview deploy’s URL, you no longer the the “Page Not Found” errors. For example:

https://5ed12b2013e8280006a6bd12--salad-website.netlify.app/main-site/

Our build configuration has “main-site” set as the base directory, and it even shows “main-site” as the deployment directory:

This obviously isn’t working correctly. Did something change on Netlify’s end? How can we fix this (given the configuration looks correct and behaved as expected just last week)?

Here’s the link to the build log for the above preview deploy:

Thanks,
Kyle

hi Kyle,

the Publish directory generally “sits on top of” or is “in addition to” the Base, if you will.

So if your Base is set to main-site, setting the publish dir to main-site won’t do much.

Is this a SSG generated app, or straight up html that you are deploying?

Thanks, perry.

I didn’t set the publish directory to “main-site”. The screenshot above is just what the Netlify UI shows. The text field itself is actually empty, and I cannot delete the “main-site” text. I assume this to mean (and can confirm that this was all working before), that the publish directory is relative to the base directory. But again, this configuration stopped working this week.

This site only contains static HTML. There’s nothing to build, I just need it to deploy the contents of the “main-site” folder.

Is this a result of the recent updates to the build environment in support of the launch of build plugins? It just seems odd that such a simple, basic configuration would break.

Thanks,
Kyle

Ok… I did a little more testing… Here are the different configurations I applied to the “Publish directory” using the Netlify UI:

configs

#1 - If the “Publish directory” is empty, then the build log (and the preview deploy) shows that the “Base directory” is ignored and Netlify ends up publishing the root folder of the Git repository! (Even though it shows “main-site”, the editable portion of the text field is empty.)

#2 - If the “Publish directory” in the Netlify UI is set to “main-site”, then the build log shows that Netlify tries to publish the folder “main-site/main-site”. This fails, obviously.

#3 - If the “Publish directory” in the Netlify UI is explicitly set to “.”, then the build log shows that Netlify tries to publish the folder “main-site/.”. This works!

So an update to my question with these new findings… Why did configuration #1 work last week but then stop working this week? Is it documented and known that one must use an explicit “.” in order for Netlify to respect the “Base directory” setting?

Thanks,
Kyle

2 Likes

We changed up build settings last week for our launch of build plugins. There wasn’t supposed to be any customer facing change for people who didn’t opt in, but perhaps we missed something. Sounds like you have a fix for now, but let me know if not!

I would class this as a serious service incident and shouldn’t be glossed over. Due to this issue my site has been “down” for the last few weeks without me knowing since it has auto-deployed from pushes to Github, but then Netflify has been deploying from the wrong directory. I’ve followed the advice from @seniorquico and it appears to work according to the logs:

10:42:50 PM: Starting to deploy site from 'website'

However my custom domain still doesn’t work at root → https://joinbeaut.com vs https://joinbeaut.com/website. Is this an isolated incident for some accounts or a more global problem?

Hiya @dirk and sorry to hear about the trouble!

Don’t mean to gloss over it at all, just want to help people get it fixed.

Your latest deploy has all files in:

/chrome
/website
/backend

I think maybe you have a directory “website” in your repo that has those things in it - and so you should use a base directory of “website/website” in that case, maybe? Our staff cannot see into your repo to be sure.

Thanks for getting back to me @fool. Apologies for the bluntness in my previous message, it was a frustrating and stressful evening trying to get this to work.

So yes, my repository has the folders chrome, website and backend at root. So, in the past, I would set the base directory of the deploy config to website and it would deploy the website directory as desired. Now, with base directory of website it deploys root for some reason…which means users need to go to https://joinbeaut.com/website to see anything which is obviously horrendous.

I’ve tried using website/website in both base directory and publish directory as you’ve suggested previously (and tried again now just to confirm), but then it throws the expected error saying that the directory doesn’t exist, because it doesn’t.

Whatever changes your development team have made to the deployment process, it now appears that deploying a non-root directory doesn’t work. I actually made a mistake in my previous reply though; I can confirm the workaround of adding the . to the publish directory “works”…well it seems to work if I look at the deployed bundle, but it’s taking a hell of a long time to propagate to my custom domain?! Shouldn’t it reflect instantaneously given the load balancing architecture in Netlify? I still need to go to https://joinbeaut.com/website to see anything. Any advice?

Can your dev team get a fix in for this? It’s most definitely not a nice user experience, and although my initial experience with Netlify has been great, this incident is worrying and disappointing. I can’t rely on a service where things break underneath me as I’m sure you can understand.

Hmm, I just tested deploying a non-root directory, works well. So something else is going on here.

Could you tell me what is in your netlify.toml file? around settings for deploy (build/publish/base in that file)?

Hello @dirk,

It looks like your latest deploy has not been set to published. You can go here: Netlify App and click on the “Start auto publishing” button, or go to a specific deploy (like Netlify App) and click on the ‘publish deploy’ button.

Let me know if you have any questions.

Ah thanks @Dennis, I turned off auto publishing whilst I was trying to debug this issue and forgot to turn it back on! If I publish my latest deploy it works, many thanks!

As the output of this thread, could you at least document the requirement for adding . to the end of the publish directory for non-root deploys please? Hopefully it will help other users from running into the same problems in the future, given the recent change in functionality. Appreciate both of your help in getting me up and running again :slight_smile:

1 Like

But look at the screenshot in the OP… the user interface leads you to believe it’s doing something entirely different. The “Publish directory” showed “main-site/”… so why would the build system ignore that and publish the root folder?

While documenting the new behavior may help prevent some confusion, it likely wouldn’t help until after the fact (exactly like what happened for dirk & me). Removing this change in behavior or changing the user interface to make this clear feels like the appropriate fix.

I’ve been able to consistently reproduce this issue on several web sites. I’m surprised at how little chatter there is on the issue. I guess it’s just not that common for people to deploy directly from a non-root base directory?

1 Like

Hey @seniorquico,

We’ve marked the topic for review, to ensure that our docs and guidance run true! If/when we have an update, we’ll let you know.

Hi all, just wanted to chime in that I had the same issue as the folks in this thread, and adding the period in the Publish directory field worked for me. I agree that it would be helpful if that step either wasn’t necessary or at least was better documented, because it took a while googling to find my way to seniorquico’s solution. Appreciate all that you all do!

1 Like

Hi, everyone. Don’t get me wrong I love Netlify, but setting up “Monorepo” mkdocs documentation under www.example.com/product1 with this UX has been one of the most frustrating experiences with Netlify. Thank you seniorquico for bringing this issue up! Adding . in the field did the job.

Hey all! Feedback duly noted and we’ll check in with the applicable teams. Thanks!

1 Like