Deploy did not succeed: Build cancelled, found file owned by root

Hi Netlify team,

I’m trying to deploy a Microsoft Teams bot using the Deploy to Netlify button with this repository: GitHub - trycourier/courier-netlify-msteams

When deploying, I’m getting this error:

Copy

12:32:22 PM: Deploy did not succeed: Build cancelled, found file owned by root

Some interesting findings:

  1. Locally, I noticed the .netlify folder gets created with root ownership during builds
  2. The project uses a redirect in netlify.toml that references the .netlify path:

toml

Copy

[[redirects]]
  from = "/api/messages"
  to = "/.netlify/functions/messages"
  status = 200

Do you have a link to the site?

Yes here is one of them

I noticed on another site/attempt that if I click “Retry” > “Clear cache and retry with latest branch commit” then it succeeds.

I see this error being mentioned internally with a completely different cause, not sure why it’s happening here. I’ll pass this to the devs.

Actually, you seem to be publishing the root of your repo. Is that intended?

Yes, is it a bad practice to publish the root of the repo?

Usually yes, unless you have a reason to do so. Looking at your repo, that doesn’t seem to be the case. You should probably add a build command: Build & deploy | Site configuration | silly-llama-502e5f | Netlify so your code actually gets built and then publish only the built files.