Skip to content

Commit

Permalink
fix: prevent Local 502 error by using unoptimized images
Browse files Browse the repository at this point in the history
Local 6.6+ uses Electron 21, which implements a new memory cage feature:

https://www.electronjs.org/blog/v8-memory-cage

The memory cage prevents Node.js modules such as sharp from working:

lovell/sharp#3384

Sharp is used by Next.js to optimize images.

The result is that Local produces a 502 when users create new sites
using this blueprint, due to the optimized logo image in the header and
in featured images.

Using the `unoptimized` prop prevents this.

The fix could be removed when Electron updates with the patched version
of Node.js that allows sharp's workaround to function, and when Local
has updated to that Electron version.
  • Loading branch information
nickcernis committed Dec 22, 2022
1 parent a5235bf commit 25eff48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/FeaturedImage/FeaturedImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default function FeaturedImage({
alt={altText}
objectFit="cover"
layout="responsive"
unoptimized={true}
{...props}
/>
</figure>
Expand Down
1 change: 1 addition & 0 deletions components/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function Header({ className, menuItems }) {
height={80}
alt="Blueprint media logo"
layout="responsive"
unoptimized={true}
/>
</a>
</Link>
Expand Down

0 comments on commit 25eff48

Please sign in to comment.