upleveled / next-js-example-spring-2023-atvie

https://next-js-example-spring-2023-vienna-austria.fly.dev/
8 stars 5 forks source link

Enforce Dynamic Rendering in Route Handlers #4

Closed Davidihl closed 1 year ago

Davidihl commented 1 year ago

To prevent students from running into a pre-render error during deployment.

Josehower commented 1 year ago

Hi @Davidihl thanks for this.

I think the need for dynamic force is not in the routes but in the pages. I may be wrong and maybe the routes also have this static behaviour. But as far as i can see the error is in /animals-admin

Error occurred prerendering page "/animals-admin". Read more: https://nextjs.org/docs/messages/prerender-error
Davidihl commented 1 year ago

@Josehower The reason I added it to route.ts is, because the error log suggests that during the deployment, the api folder is pre-rendered

`#14 38.73 Error occurred prerendering page "/api/products". Read more: https://nextjs.org/docs/messages/prerender-error

14 38.73 Error: connect ECONNREFUSED ::1:5432`

Josehower commented 1 year ago

Thanks i think 2 more small changes and we are ready to merge this