vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.09k stars 27.01k forks source link

[NEXT-903] sitemap.xml not generated #47574

Closed juliusmarminge closed 1 year ago

juliusmarminge commented 1 year ago

Verify canary release

Provide environment information

Vercel

next12.2.5@canary-19

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true)

Link to the code that reproduces this issue

https://github.com/juliusmarminge/jumr.dev

To Reproduce

Follows @leerob’s tweet https://twitter.com/leeerob/status/1639639575843729409?s=46&t=Uy_Hg1WWwsYDe1YleBLsaA to setup sitemap & robot. (Source: https://github.com/leerob/leerob.io/blob/main/app/sitemap.ts).

Describe the Bug

unfortunatly, no sitemap seems to be om generated: https://jumr.dev/sitemap.xml

Expected Behavior

Route above not to 404, see https://leerob.io/sitemap.xml

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Vercel

leerob commented 1 year ago

Could you try without using the src/ directory? That's my first guess looking at this. Thanks for opening!

juliusmarminge commented 1 year ago

Could you try without using the src/ directory? That's my first guess looking at this. Thanks for opening!

Still 404-ing after refactoring not to use src/:

https://jumr.dev/sitemap.xml

https://github.com/juliusmarminge/jumr.dev/blob/main/app/sitemap.ts

Vercel build logs aren't mentioning sitemap anywhere (unsure if it should though):

Build logs ``` [10:22:13.638] Running build in Cleveland, USA (East) – cle1 [10:22:13.695] Cloning github.com/juliusmarminge/jumr.dev (Branch: main, Commit: 55b6d6c) [10:22:14.241] Cloning completed: 545.745ms [10:22:17.387] Restored build cache [10:22:17.409] Running "vercel build" [10:22:17.854] Vercel CLI 28.18.1 [10:22:18.143] Detected `pnpm-lock.yaml` generated by pnpm 7... [10:22:18.161] Installing dependencies... [10:22:18.771] Lockfile is up to date, resolution step is skipped [10:22:18.849] Already up to date [10:22:19.187] [10:22:19.188] Done in 981ms [10:22:19.199] Detected Next.js version: 13.2.5-canary.19 [10:22:19.208] Running "pnpm run build" [10:22:19.705] [10:22:19.705] > jumr.dev@0.1.0 build /vercel/path0 [10:22:19.705] > next build [10:22:19.705] [10:22:20.233] warn - You have enabled experimental feature (appDir) in next.config.mjs. [10:22:20.234] warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk. [10:22:20.234] [10:22:20.234] info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback [10:22:20.349] info - Creating an optimized production build... [10:22:35.239] info - Compiled successfully [10:22:35.241] info - Linting and checking validity of types... [10:22:43.246] info - Collecting page data... [10:22:44.613] info - Generating static pages (0/4) [10:22:44.732] info - Generating static pages (1/4) [10:22:44.742] info - Generating static pages (2/4) [10:22:45.092] info - Generating static pages (3/4) [10:22:45.167] info - Generating static pages (4/4) [10:22:45.186] info - Finalizing page optimization... [10:22:45.188] [10:22:45.207] Route (app) Size First Load JS [10:22:45.207] ┌ ○ / 641 B 115 kB [10:22:45.207] ├ ○ /blog/t3-turbo 6.97 kB 88.8 kB [10:22:45.207] └ ℇ /og-image 0 B 0 B [10:22:45.207] + First Load JS shared by all 71.4 kB [10:22:45.207] ├ chunks/191-9229a1791df025b3.js 69.6 kB [10:22:45.207] ├ chunks/main-app-c0e0ab07e2b1e6e9.js 209 B [10:22:45.207] └ chunks/webpack-0c0dc91358b4ed7f.js 1.64 kB [10:22:45.207] [10:22:45.207] Route (pages) Size First Load JS [10:22:45.207] ─ ○ /404 178 B 84.8 kB [10:22:45.208] + First Load JS shared by all 84.6 kB [10:22:45.208] ├ chunks/main-1f31eb637c7ced03.js 82.8 kB [10:22:45.208] ├ chunks/pages/_app-2e7c5ec3e6a7ade2.js 192 B [10:22:45.208] └ chunks/webpack-0c0dc91358b4ed7f.js 1.64 kB [10:22:45.208] [10:22:45.208] ℇ (Streaming) server-side renders with streaming (uses React 18 SSR streaming or Server Components) [10:22:45.208] ○ (Static) automatically rendered as static HTML (uses no initial props) [10:22:45.208] [10:22:47.140] Traced Next.js server files in: 1.212s [10:22:52.872] Created all serverless functions in: 5.732s [10:22:53.109] Collected static files (public/, static/, .next/static): 5.478ms [10:22:53.463] Build Completed in /vercel/output [35s] [10:23:03.110] Generated build outputs: [10:23:03.110] - Static files: 38 [10:23:03.110] - Prerenders: 4 [10:23:03.110] - Serverless Functions: 0 [10:23:03.110] - Edge Functions: 1 [10:23:03.110] Serverless regions: Washington, D.C., USA [10:23:03.110] Deployed outputs in 7s [10:23:03.425] Build completed [10:23:10.998] Uploading build cache [99.81 MB]... [10:23:13.636] Build cache uploaded: 2.637s ```
huozhi commented 1 year ago

You're ignoring ts in pageExension in your next config but using ts as file extension for robots and sitemap routes. Changing the file extension to tsx or add ts into pageExtension can fix it

juliusmarminge commented 1 year ago

You're ignoring ts in pageExension in your next config but using ts as file extension for robots and sitemap routes. Changing the file extension to tsx or add ts into pageExtension can fix it

Aaaahh, silly me. Sorry for the confusion...

github-actions[bot] commented 1 year ago

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