Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID of generateSitemaps doesn't work in production for sitemap #60894

Closed
1 task done
hc0503 opened this issue Jan 19, 2024 · 3 comments · Fixed by #61088
Closed
1 task done

ID of generateSitemaps doesn't work in production for sitemap #60894

hc0503 opened this issue Jan 19, 2024 · 3 comments · Fixed by #61088
Labels
bug Issue was opened via the bug report template. locked

Comments

@hc0503
Copy link

hc0503 commented Jan 19, 2024

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/adoring-spence-ypzmjh?file=%2Fapp%2Fbooks%2Fsitemap.ts%3A5%2C1

To Reproduce

If I call /books/sitemap/10.xml in production, the console.log shows 1.
That should return not found or 10
This bug is happened in only production.

Current vs. Expected behavior

That should return correct id. If it's existed, it should return not found like dev mode.

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Home  
Binaries:
  Node: 20.9.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.1.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

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

App Router

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

next build (local)

Additional context

The generateSitemaps works well in development mode, but that has above error in production mode.
It seems like be Next.js issue.

@hc0503 hc0503 added the bug Issue was opened via the bug report template. label Jan 19, 2024
@craftedsro

This comment has been minimized.

huozhi added a commit that referenced this issue Jan 24, 2024
### What

Fixes the string id that broken when sitemap is optimized to static
route.

### Why

When sitemap is optimized to static route in production, the route
argument is changed from `[[...__metadata_id__]]` to
`[__metadata_id__]`, so the type of it is also changed from array to
string that should reflect in the loader code.

Fixes #60894 
Closes NEXT-2154
Copy link
Contributor

github-actions bot commented Feb 8, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Feb 8, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 8, 2024
huozhi added a commit that referenced this issue Mar 4, 2024
Fixes the string id that broken when sitemap is optimized to static
route.

When sitemap is optimized to static route in production, the route
argument is changed from `[[...__metadata_id__]]` to
`[__metadata_id__]`, so the type of it is also changed from array to
string that should reflect in the loader code.

Fixes #60894
Closes NEXT-2154
@huozhi
Copy link
Member

huozhi commented Mar 5, 2024

This fix is landed in 14.1.2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants