next.js: Nested sitemaps seem to 404 in Next.js 15

Link to the code that reproduces this issue

https://github.com/JamesSingleton/sitemap-issue

To Reproduce

  1. Start the app running pnpm dev
  2. Go to http://localhost:3000/resources/sitemap.xml/0 since in dev mode that’s where it is supposed to live according to the docs
  3. You will get a 404
  4. You can also do pnpm build && pnpm start and then go to http://localhost:3000/resources/sitemap/0.xml and you will get a 404 as well.

Screenshot 2024-11-13 at 19 10 24

Current vs. Expected behavior

In Next 14 this worked just fine. However, after upgrading to Next 15 this no longer works.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 20.15.0
  npm: 10.7.0
  Yarn: 1.22.22
  pnpm: 9.13.0
Relevant Packages:
  next: 15.0.4-canary.11 // Latest available version is detected (15.0.4-canary.11).
  eslint-config-next: 15.0.3
  react: 19.0.0-rc-66855b96-20241106
  react-dom: 19.0.0-rc-66855b96-20241106
  typescript: 5.6.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local), Vercel (Deployed)

Additional context

If you go to localhost:3000/sitemap.xml it will load that sitemap just fine Screenshot 2024-11-13 at 19 14 33

I even tried moving the sitemap.ts to just app/resources/sitemap.ts and going to http://localhost:3000/resources/sitemap.xml/0 still does not load anything

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 21 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@JamesSingleton Thank you for the feedback! Will be sharing with the team. <picture data-single-emoji=":blob_bowing:" title=":blob_bowing:">:blob_bowing:</picture>

I think it’s more like the CSS Modules where it doesn’t change unless something else changes (in the process of figuring that out).

Let me know what you find out because having dynamic sitemaps would mean things could change pretty frequently and therefore the hash would change. It’s a little concerning we are roughly a month and a half out from the v15 release and this was just now caught (probably not the right terminology). This is a major change in how users handle sitemaps, you’re basically forcing everyone to now go into their Google Search Console, Bing, etc and update the sitemaps that search engines look at because of a change Next.js made and not one they deliberately made.

I didn’t see that anywhere which would be an undocumented breaking change 👎🏼

Agreed, so that’s on us! That’s why we’re updating the docs now.

Also, does that hash change on every single build?

I think it’s more like the CSS Modules where it doesn’t change unless something else changes (in the process of figuring that out).

I’ve also been having sitemap 404 issues on https://github.com/aelew/devterms using Next.js 15.0.3. Worked fine on 14. Google hasn’t been able to read my dynamic sitemaps ever since I upgraded 🫤