Uploaded ads.txt not visible on root

Hey all,

Google is telling me to upload an ads.txt file in the root directory of my site, which I’ve done. The problem is that if I go to domain.com/ads.txt I get a 404 error.

I think this is because I used a webflow → Jamstack converter, which I’m then hosting through netlify.

Any ideas how I can get the site to recognize the file? I’ve confirmed it’s in my github repo, and that it’s been pushed to production successfully.

We need a site name to check :slight_smile:

Hey! Sorry about the delay on this. The site is located here.

Can you try putting ads.txt file in the root of the repository? I’m not seeing it there on the site or in the screenshot.

You can also change your build command to copy the file to your public folder after running npx @11ty/eleventy.

I just added it to the root again (screenshot proof), but navigating to the /ads.txt file still throws a 404.

I even included it in every folder inside of the root directory, and it’s still not visible.

I’m a bit unfamiliar with commands, right now the site is getting deployed to netlify whenever there is a new push on github.

Is there an alternative way I can add it to a public folder? (I don’t see a public folder)

Change build command here: Netlify App to : npm run build && cp "./ads.txt" "./public/ads.txt"

It looks like I’m getting a conflicting build message from the deploy log, and it’s using the basic npm run build instead.

Here’s the full console log, and screenshot showing my build settings.

12:30:50 PM: build-image version: 1ca34a93198b041e44214013884c57d146a23fed (focal)
12:30:50 PM: build-image tag: v4.16.4
12:30:50 PM: buildbot version: 30bb0dbce9c066d58cbd3a36ad34f8c91a4777a3
12:30:50 PM: Fetching cached dependencies
12:30:50 PM: Starting to download cache of 174.6MB
12:30:52 PM: Finished downloading cache in 2.298s
12:30:52 PM: Starting to extract cache
12:30:56 PM: Finished extracting cache in 4.108s
12:30:56 PM: Finished fetching cache in 6.501s
12:30:56 PM: Starting to prepare the repo for build
12:30:56 PM: Preparing Git Reference refs/heads/master
12:30:57 PM: Parsing package.json dependencies
12:30:58 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'npm run build' versus 'npm run build && cp "./ads.txt" "./public/ads.txt"' in the Netlify UI
12:30:58 PM: Starting build script
12:30:58 PM: Installing dependencies
12:30:58 PM: Python version set to 2.7
12:30:58 PM: Started restoring cached Node.js version
12:31:01 PM: Finished restoring cached Node.js version
12:31:01 PM: v16.19.0 is already installed.
12:31:02 PM: Now using node v16.19.0 (npm v8.19.3)
12:31:02 PM: Enabling Node.js Corepack
12:31:02 PM: Started restoring cached build plugins
12:31:02 PM: Finished restoring cached build plugins
12:31:02 PM: Attempting Ruby version 2.7.2, read from environment
12:31:03 PM: Using Ruby version 2.7.2
12:31:03 PM: Using PHP version 8.0
12:31:03 PM: Started restoring cached corepack dependencies
12:31:03 PM: mv: cannot move '/opt/build/cache/.node/corepack' to '/opt/buildhome/.node/corepack': No such file or directory
12:31:03 PM: Finished restoring cached corepack dependencies
12:31:03 PM: No npm workspaces detected
12:31:03 PM: Started restoring cached node modules
12:31:03 PM: Finished restoring cached node modules
12:31:03 PM: Bypassing sha validation. Running pre & post install scripts
12:31:03 PM: Installing npm packages using npm version 8.19.3
12:31:07 PM: up to date, audited 413 packages in 4s
12:31:07 PM: 42 packages are looking for funding
12:31:07 PM:   run `npm fund` for details
12:31:07 PM: 6 vulnerabilities (3 moderate, 3 high)
12:31:07 PM: To address issues that do not require attention, run:
12:31:07 PM:   npm audit fix
12:31:07 PM: Some issues need review, and may require choosing
12:31:07 PM: a different dependency.
12:31:07 PM: Run `npm audit` for details.
12:31:07 PM: npm packages installed
12:31:08 PM: Started restoring cached go cache
12:31:08 PM: Finished restoring cached go cache
12:31:08 PM: Installing Go version 1.17 (requested 1.17)
12:31:17 PM: unset GOOS;
12:31:17 PM: unset GOARCH;
12:31:17 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
12:31:17 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
12:31:17 PM: go version >&2;
12:31:17 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
12:31:17 PM: go version go1.17 linux/amd64
12:31:17 PM: Detected 1 framework(s)
12:31:17 PM: "eleventy" at version "1.0.0"
12:31:17 PM: Installing missing commands
12:31:17 PM: Verify run directory
12:31:17 PM: Section completed: initializing
12:31:19 PM: ​
12:31:19 PM:   Netlify Build                                                 
12:31:19 PM: ────────────────────────────────────────────────────────────────
12:31:19 PM: ​
12:31:19 PM: ❯ Version
12:31:19 PM:   @netlify/build 29.5.1
12:31:19 PM: ​
12:31:19 PM: ❯ Flags
12:31:19 PM:   baseRelDir: true
12:31:19 PM:   buildId: 63cee06348e9ad1dd714a4e1
12:31:19 PM:   deployId: 63cee06348e9ad1dd714a4e3
12:31:19 PM: ​
12:31:19 PM: ❯ Current directory
12:31:19 PM:   /opt/build/repo
12:31:19 PM: ​
12:31:19 PM: ❯ Config file
12:31:19 PM:   /opt/build/repo/netlify.toml
12:31:19 PM: ​
12:31:19 PM: ❯ Context
12:31:19 PM:   production
12:31:19 PM: ​
12:31:19 PM:   1. build.command from netlify.toml                            
12:31:19 PM: ────────────────────────────────────────────────────────────────
12:31:19 PM: ​
12:31:19 PM: $ npm run build
12:31:19 PM: > prebuild
12:31:19 PM: > npm run optimize
12:31:19 PM: > optimize
12:31:19 PM: > node ./_utils/scripts/optimize-assets.js
12:31:19 PM: > build
12:31:19 PM: > npx @11ty/eleventy
12:31:21 PM: [11ty] Copied 59 files / Wrote 29 files in 0.52 seconds (17.9ms each, v1.0.0)
12:31:21 PM: ​
12:31:21 PM: (build.command completed in 1.9s)
12:31:21 PM: ​
12:31:21 PM:   2. Functions bundling                                         
12:31:21 PM: ────────────────────────────────────────────────────────────────
12:31:21 PM: ​
12:31:21 PM: The Netlify Functions setting targets a non-existing directory: functions
12:31:21 PM: ​
12:31:21 PM: (Functions bundling completed in 1ms)
12:31:21 PM: ​
12:31:21 PM:   3. Deploy site                                                
12:31:21 PM: ────────────────────────────────────────────────────────────────
12:31:21 PM: ​
12:31:21 PM: Starting to deploy site from 'public'
12:31:21 PM: Calculating files to upload
12:31:21 PM: 29 new files to upload
12:31:21 PM: Starting post processing
12:31:21 PM: 0 new functions to upload
12:31:21 PM: Section completed: deploying
12:31:21 PM: Site deploy was successfully initiated
12:31:21 PM: ​
12:31:21 PM: Post processing - HTML
12:31:21 PM: (Deploy site completed in 353ms)
12:31:21 PM: ​
12:31:21 PM:   Netlify Build Complete                                        
12:31:21 PM: ────────────────────────────────────────────────────────────────
12:31:21 PM: ​
12:31:21 PM: (Netlify Build completed in 2.3s)
12:31:21 PM: Caching artifacts
12:31:22 PM: Processing form - wf-form-Subscribe-Form
12:31:21 PM: Started saving node modules
12:31:21 PM: Finished saving node modules
12:31:21 PM: Started saving build plugins
12:31:22 PM: Detected form fields: - Subscribe-Form-Email-2
12:31:21 PM: Finished saving build plugins
12:31:21 PM: Started saving pip cache
12:31:21 PM: Finished saving pip cache
12:31:21 PM: Started saving emacs cask dependencies
12:31:21 PM: Finished saving emacs cask dependencies
12:31:21 PM: Started saving maven dependencies
12:31:21 PM: Finished saving maven dependencies
12:31:21 PM: Started saving boot dependencies
12:31:21 PM: Finished saving boot dependencies
12:31:21 PM: Started saving rust rustup cache
12:31:21 PM: Finished saving rust rustup cache
12:31:21 PM: Started saving go dependencies
12:31:21 PM: Finished saving go dependencies
12:31:22 PM: Processing form - wf-form-Netlify-Form
12:31:21 PM: Build script success
12:31:21 PM: Section completed: building
12:31:22 PM: Uploading Cache of size 174.7MB
12:31:22 PM: Detected form fields: - name - email - Comments
12:31:23 PM: Post processing - header rules
12:31:23 PM: Post processing - redirect rules
12:31:24 PM: Section completed: cleanup
12:31:24 PM: Post processing done
12:31:24 PM: Finished processing build request in 34.087s
12:31:24 PM: Section completed: postprocessing
12:31:25 PM: Site is live ✨```

Yup, that’s exactly the problem, and the logline tells you exactly how to fix it:

12:30:58 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'npm run build' versus 'npm run build && cp "./ads.txt" "./public/ads.txt"' in the Netlify UI

So, you need to edit netlify.toml one way or the other to change the build command to what you want us to run, or to remove the build command entirely so we use what you specified in the UI.

Oh I totally missed that, thanks so much!

For those that run into this in the future, I was getting an error when replacing the command line in the netlify.toml file, but since it was set in the Netlify UI, all I had to do was remove that line in the file, and the site deployed perfectly.

1 Like

Hi @wildkarrde :wave:t6: ,

Thanks so much for sharing what you did to fix the error. We appreciate the feedback. (: