Google Search Console says “Couldn’t fetch” for my Next.js sitemap
Unanswered
Staffordshire Bull Terrier posted this in #help-forum
Staffordshire Bull TerrierOP
I’m stuck on an issue with my Next.js sitemap and can’t figure out what’s causing it.
I set up a sitemap.ts and added all of my pages. The sitemap is live and opens fine in the browser, but every time I submit it to Google Search Console, it says “Couldn’t fetch”.
Here’s what I’ve already tried:
- Made sure the sitemap is publicly accessible.
- Checked that Cloudflare isn’t blocking anything.
- Confirmed I’m submitting the correct sitemap URL.
- Waited over a week and submitted it again.
- Resubmitted it a few more times, but I keep getting the same error.
I’m out of ideas at this point. Has anyone run into this before or know what could be causing it?
If it helps, I can share my sitemap.ts, robots.txt, and the sitemap URL.
I set up a sitemap.ts and added all of my pages. The sitemap is live and opens fine in the browser, but every time I submit it to Google Search Console, it says “Couldn’t fetch”.
Here’s what I’ve already tried:
- Made sure the sitemap is publicly accessible.
- Checked that Cloudflare isn’t blocking anything.
- Confirmed I’m submitting the correct sitemap URL.
- Waited over a week and submitted it again.
- Resubmitted it a few more times, but I keep getting the same error.
I’m out of ideas at this point. Has anyone run into this before or know what could be causing it?
If it helps, I can share my sitemap.ts, robots.txt, and the sitemap URL.
36 Replies
@Staffordshire Bull Terrier I’m stuck on an issue with my Next.js sitemap and can’t figure out what’s causing it.
I set up a sitemap.ts and added all of my pages. The sitemap is live and opens fine in the browser, but every time I submit it to Google Search Console, it says “Couldn’t fetch”.
Here’s what I’ve already tried:
- Made sure the sitemap is publicly accessible.
- Checked that Cloudflare isn’t blocking anything.
- Confirmed I’m submitting the correct sitemap URL.
- Waited over a week and submitted it again.
- Resubmitted it a few more times, but I keep getting the same error.
I’m out of ideas at this point. Has anyone run into this before or know what could be causing it?
If it helps, I can share my sitemap.ts, robots.txt, and the sitemap URL.
Yes, please share the Sitemap url that you enter into google search console. Also show some screenshots of the google search console that shows the issues
Hmm you can live test your url via google search console. Then it uses google servers to get the Sitemap. For that navigate to “url inspection” and run it there. It gives you plenty of details on what happens on serverside (from google) and why it couldn’t fetch. Or if everything worked then we can check further
Btw, you robots also not explicitly allowing the google bot to crawl. And also Cloudflare might not allow the google bot to crawl (during Cloudflare setup you are asked if you want to allow crawlers. It’s by default denied, so it happens very fast that crawlers are blocked)
Btw, you robots also not explicitly allowing the google bot to crawl. And also Cloudflare might not allow the google bot to crawl (during Cloudflare setup you are asked if you want to allow crawlers. It’s by default denied, so it happens very fast that crawlers are blocked)
@B33fb0n3 Hmm you can live test your url via google search console. Then it uses google servers to get the Sitemap. For that navigate to “url inspection” and run it there. It gives you plenty of details on what happens on serverside (from google) and why it couldn’t fetch. Or if everything worked then we can check further
Btw, you robots also not explicitly allowing the google bot to crawl. And also Cloudflare might not allow the google bot to crawl (during Cloudflare setup you are asked if you want to allow crawlers. It’s by default denied, so it happens very fast that crawlers are blocked)
Staffordshire Bull TerrierOP
I checked Cloudflare, it isn't blocking it, even the [robot.txt](https://lumierelabs.xyz/robots.txt) and when I submit it manually in the GSC, it returns this error
@Staffordshire Bull Terrier I checked Cloudflare, it isn't blocking it, even the [robot.txt](https://lumierelabs.xyz/robots.txt) and when I submit it manually in the GSC, it returns this error
I am just curious: you don’t do any illegal stuff or stuff that is against google terms, right?
@B33fb0n3 I am just curious: you don’t do any illegal stuff or stuff that is against google terms, right?
Staffordshire Bull TerrierOP
Not at all
@Staffordshire Bull Terrier Not at all
Can you remove the robots.txt completely for a moment. So it returns, like it would never exist. Then fetch the page on your own using google dns and see if the result is also 404 (to prevent false positives through caching). Then rerun the live test on google
@B33fb0n3 Can you remove the robots.txt completely for a moment. So it returns, like it would never exist. Then fetch the page on your own using google dns and see if the result is also 404 (to prevent false positives through caching). Then rerun the live test on google
Staffordshire Bull TerrierOP
Removed the robot.txt rerun the sitemap still the same issue of couldn’t fetch
@Staffordshire Bull Terrier Removed the robot.txt rerun the sitemap still the same issue of couldn’t fetch
If you try with removed robots.txt the fetch of your normal page (without any Sitemap.xml path or similar) does it work?
@B33fb0n3 If you try with removed robots.txt the fetch of your normal page (without any Sitemap.xml path or similar) does it work?
Staffordshire Bull TerrierOP
It abled to index only 3 of my pages
The root page, about and the docs one the rest it doesn’t index it and I believe I indexed the /about by submitting it separately through the inspect
The root page, about and the docs one the rest it doesn’t index it and I believe I indexed the /about by submitting it separately through the inspect
When I do next site map it gives me two URLs on build when I sign up for Google search console it says the first one always fails until I enter the second one
@Patrick MacDonald When I do next site map it gives me two URLs on build when I sign up for Google search console it says the first one always fails until I enter the second one
Staffordshire Bull TerrierOP
Uhmmmm how? Pls elaborate
The way I I've learned to configure next site maps when I do a build. Not only does it produce a robots.txt but also two site maps. One sitemap is like an index and one sitemap is the actual site map. When entering them into Google search console, when I enter only one of them or the non-indexed one, it says that there is an error and could not fetch. When I enter the second one in the first one gets marked green and then the second one gets marked green.
I'm at work right now but if you at me I can show you my config file for the site maps to see if that helps you if you think that this might be useful
Next site map config :
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: 'https://clockout.patmac.ca',
generateRobotsTxt: true,
sitemapSize: 7000,
}@Staffordshire Bull Terrier keep in mind, that Patrick uses “next-sitemap” as dependency to generate sitemap and robots. So just adding the config it won’t work
Sorry when you said site map next JS I thought they were talking about the package
My bad
@Staffordshire Bull Terrier solved?
@B33fb0n3 <@774249602621767731> solved?
Staffordshire Bull TerrierOP
Not yet
Wat if I just delete the property and reconfigure it again?
Wat if I just delete the property and reconfigure it again?
Will that solve?
@Staffordshire Bull Terrier Not yet
Wat if I just delete the property and reconfigure it again?
I don’t think that would solve it. It looks more like a server issue at google..
Staffordshire Bull TerrierOP
It’s been over a month
@Staffordshire Bull Terrier It’s been over a month
You can try it, but I al pretty sure it won’t solve the issue. What about a new domain?
@B33fb0n3 You can try it, but I al pretty sure it won’t solve the issue. What about a new domain?
Staffordshire Bull TerrierOP
Buy new domain?
@Staffordshire Bull Terrier Buy new domain?
Yea and index that one
@B33fb0n3 Yea and index that one
Staffordshire Bull TerrierOP
Can I try the vercel subdomain one?
@Staffordshire Bull Terrier Can I try the vercel subdomain one?
Try it, but I don’t think that would help you, when you Domain itself is blacklisted (or similar) on google
@B33fb0n3 Try it, but I don’t think that would help you, when you Domain itself is blacklisted (or similar) on google
Staffordshire Bull TerrierOP
Is there a way to check if my domain is blacklisted
@Staffordshire Bull Terrier Is there a way to check if my domain is blacklisted
I don’t know one. What you can do: open dev tools, do the “live url inspection” thing and check the network logs. Identify the request that is send to google for the live inspection and check the actual result. You can often get more details like that
@Staffordshire Bull Terrier checked?
@B33fb0n3 <@774249602621767731> checked?
Staffordshire Bull TerrierOP
Yep no 404 errors at all
I amma delete the property and re configure it and hope it works
@Staffordshire Bull Terrier I amma delete the property and re configure it and hope it works
give us an update once done
Indian mackerel
Same issue happened with me try add the / at the end of sitemap url
e.g - example.com/sitemap.xml/
it worked for me
e.g - example.com/sitemap.xml/
it worked for me