vercel / platforms

A full-stack Next.js app with multi-tenancy and custom domain support. Built with Next.js App Router and the Vercel Domains API.
https://app.vercel.pub
5.38k stars 689 forks source link

New Blog posts by user showing as error 500 #340

Open mcxleague opened 8 months ago

mcxleague commented 8 months ago

When a user makes a new post to there site it returns error 500 when they visit the new post. Everything else seems to work fine

aleplusplus commented 8 months ago

Same here!

bradledford commented 8 months ago

Was there any resolution to this? I get this intermittently on localhost when adding an image to new posts.

steven-tey commented 7 months ago

Can you please provide steps to reproduce this? Thank you!

focusonyoursite commented 7 months ago

@steven-tey I found this error in the vercel logs:

⨯ Page changed from static to dynamic at runtime /babble.****.com/clp5gg0v20003jk08hb1tanco, reason: headers see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error at l (/var/task/.next/server/chunks/441.js:7:10073) at d (/var/task/.next/server/chunks/753.js:1:1093) at c (/var/task/.next/server/app/[domain]/[slug]/page.js:1:59254) at em (/var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:128289) at /var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:139989 at Object.toJSON (/var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:143567) at stringify () at eE (/var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:131952) at eR (/var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:132395) at Timeout._onTimeout (/var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:129175) { page: '/babble.**.com/clp5gg0v20003jk08hb1tanco' } Page changed from static to dynamic at runtime /babble..com/clp5gg0v20003jk08hb1tanco, reason: headers see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error at l (/var/task/.next/server/chunks/441.js:7:10073) at d (/var/task/.next/server/chunks/753.js:1:1093) at c (/var/task/.next/server/app/[domain]/[slug]/page.js:1:59254) at em (/var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:128289) at /var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:139989 at Object.toJSON (/var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:143567) at stringify () at eE (/var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:131952) at eR (/var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:132395) at Timeout._onTimeout (/var/task/node_modules/.pnpm/next@14.0.2_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:129175) { page: '/babble.**.com/clp5gg0v20003jk08hb1tanco' } Error: Runtime exited with error: exit status 1 Runtime.ExitError

rqdewise commented 7 months ago

This also happened and still my problem.

Opening a post in any individual site would result to internal server error 500 only happens in production only. While, build error show "Error occurred prerendering page "./page".

wangqiaobook commented 7 months ago

When a user makes a new post to there site it returns error 500 when they visit the new post. Everything else seems to work fine

In this project, at the following address: /app/[domain]/[slug]/page.tsx There is a function named generateStaticParams in this file responsible for generating static pages. However, in the original code, there is a limitation that restricts the data retrieval to only subdomains with the name "demo" for generating static pages. As a result, static pages cannot be generated for subdomains created by users.

The solution is straightforward: remove or comment out the code segment responsible for this limitation.

截屏2023-11-26 23 19 05
rqdewise commented 7 months ago

@wangqiaobook Yes, I have done this part. In dev mode static pages are generated smoothly but in production generating static pages always result in error.

justanexperiment commented 6 months ago

@wangqiaobook thank you!! this saved me hours

mworks-proj commented 2 months ago

I've tried commenting out this snippet of code in both sections, however, with no luck. Production is still rendering 500 internal server error on clicking any site link/ stories. Can you share your complete file (use default domain name)?