Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent Local 502 error by using unoptimized images #103

Closed
wants to merge 1 commit into from

Conversation

nickcernis
Copy link
Member

@nickcernis nickcernis commented Dec 22, 2022

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's Node.js process crashes, resulting in a 502 when Local 6.6+ users create new sites using this blueprint, due to the optimized logo image in the header and in featured images:

Screenshot 2022-12-22 at 13 42 56

Using the unoptimized prop prevents this for now.

This workaround 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. (The Electron 21 patch has not been released at the time of writing: electron/electron#36625 )

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.
@nickcernis nickcernis requested a review from a team as a code owner December 22, 2022 13:04
nickcernis added a commit that referenced this pull request Jan 3, 2023
Adopts the latest version of the sharp library so that image resizing
will work with the latest versions of Electron, once it updates with
a fix for the memory cage issue.

See lovell/sharp#3384.

Replaces #103.
@nickcernis
Copy link
Member Author

Replacing with #104.

@nickcernis nickcernis closed this Jan 3, 2023
@mindctrl mindctrl deleted the nc/fix-local-502 branch July 20, 2023 11:24
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.

None yet

1 participant