Skip to content

[nextjs] NextImage causes 500 Internal Server Error on Vercel after layout updates in basic-nextjs-pages-router - #626

Open
sc-naveenhedallaarachchi wants to merge 2 commits into
devfrom
JSS-10378-NextImage-server-err-fix
Open

sc-naveenhedallaarachchi wants to merge 2 commits into
devfrom
JSS-10378-NextImage-server-err-fix

Conversation

@sc-naveenhedallaarachchi

Copy link
Copy Markdown
Contributor

Description / Motivation

Summary

Fixes a production 500 Internal Server Error when rendering Sitecore NextImage components on Vercel.

Next.js attempts to sort frozen image configuration arrays, causing:

TypeError: Cannot assign to read only property '0' of object '[object Array]'

Changes

  • Clone frozen Next.js image configuration arrays before rendering.
  • Clone Sitecore image field values to avoid mutating layout data.
  • Fall back to a native when the known sorting error occurs.
  • Add regression tests for frozen image fields and configuration arrays.

Testing Details

  • Unit Test Added
  • Manual Test/Other (Please elaborate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@changeset-bot

changeset-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e92ca0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sitecore-content-sdk/nextjs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

📦 Package Size and Test Coverage Report

Package Base Size PR Size Δ Change Base Coverage PR Coverage Δ Change
analytics-core 69.05 KB 69.05 KB ✅ 0.00 KB 97.44% 97.44% 0.00%
angular 421.74 KB 421.74 KB ✅ 0.00 KB 94.08% 94.08% 0.00%
cli 63.35 KB 63.35 KB ✅ 0.00 KB 73.80% 73.80% 0.00%
content 517.53 KB 517.53 KB ✅ 0.00 KB 93.16% 93.16% 0.00%
core 139.38 KB 139.38 KB ✅ 0.00 KB 91.80% 91.80% 0.00%
create-content-sdk-app 549.69 KB 549.69 KB ✅ 0.00 KB 96.47% 96.47% 0.00%
events 72.33 KB 72.33 KB ✅ 0.00 KB 97.97% 97.97% 0.00%
nextjs 589.52 KB 600.17 KB 🔺 +10.65 KB 91.97% 91.95% -0.02%
personalize 64.01 KB 64.01 KB ✅ 0.00 KB 99.74% 99.74% 0.00%
react 254.44 KB 254.44 KB ✅ 0.00 KB 93.83% 93.83% 0.00%
search 16.69 KB 16.69 KB ✅ 0.00 KB 98.89% 98.89% 0.00%
Total 🔺 +10.65 KB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant