ubi sage
ubi sage

Reputation: 93

Internal Server Error on Production with NextJs 13, sanity and netlify

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

Answers (2)

Oskar Hertzman
Oskar Hertzman

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

ubi sage
ubi sage

Reputation: 93

The issue seems to be in next js.

Possible fix at this time of msg is:

Upgrade or downgrade it to next v 13.4.8

Observation:

In netlify logs found this error enter image description here

Which leads to this github issue github . Where the suggested fix was move your next version to 13.4.8

Upvotes: 0

Related Questions