Reputation: 93
Description I am using next js and hosted website on netlify with cms being sanity The page (blog page) which uses sanity for content return 500 (Internal server error), on hosted site on netlify But it works fine on both local development and local build{npm run dev and also on npm run build && npm run start}
Dependencies
What could be the possible reasons for this
Upvotes: 1
Views: 189
Reputation: 321
For people have problem with amp-context or other context files, there is a solution for Next js 14 + that seemed to work for me, amp-context is imported dynamically, which means it won't be properly included in the Netlify function. We can force include it like this, i had problem with router-context and head-manager-context so i included those aswell:
netlify.toml:
[functions]
included_files = [
"node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/router-context*",
"node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/amp-context*",
"node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/head-manager-context*",
]
Upvotes: 0