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

From Discord: V8 Cloning Errors in Electron with Fiber-Passed Objects #828

Open
effect-bot opened this issue Sep 4, 2024 · 0 comments
Open

Comments

@effect-bot
Copy link

Summary

Summary:

  • Issue: The user is experiencing V8 cloning errors in Electron when objects returned by a Fiber are passed through serialization code. These objects are plain objects, but they can't be cloned.
  • Possible Cause: The user suspects that Effect.fail(serializableValue) might be returning a proxy object instead of a plain object.
  • Confirmation: Michael Arnaldi confirms that Effect.fail does indeed create a proxy to attach the stack trace.
  • Solution: Michael suggests that the original instance can be restored to avoid the cloning issue.
  • Additional Context: Michael mentions that in prior versions, the stack trace was attached to the Cause, but it was lost when re-raising an error, leading to the current proxy approach. He also notes that this behavior should be documented.

Key Takeaways:

  1. Effect.fail and Proxies: Effect.fail creates a proxy object to attach stack traces, which can cause issues with object serialization in environments like Electron.
  2. Restoring Original Instances: There is a way to restore the original instance from the proxy to avoid serialization issues.
  3. Documentation: The behavior of Effect.fail creating proxies for stack traces should be documented to help developers understand and troubleshoot similar issues.
  4. Edge Cases: This issue is considered an edge case but is important for developers working with serialization and error handling in complex environments.

Discord thread

https://discord.com/channels/795981131316985866/1280961299236388865

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

No branches or pull requests

1 participant