Kysely: Proxy invariant violation: effectifyWith fails for non-configurable properties
#5982
+7
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type
Description
Bug Description
When using
@effect/sql-kyselywithEffect.fn, aTypeErroris thrown due to JavaScript Proxy invariant violations. The error occurs because theeffectifyWithproxy handler doesn't properly pass through non-configurable properties.Error Messages
Root Cause
The
effectifyWithfunction in@effect/sql-kyselycreates a Proxy that wraps Kysely query builders to make them Effect-compatible. However, the proxy'sgethandler violates a fundamental JavaScript Proxy invariant:The current implementation recursively wraps all property accesses, including:
Symbol(effect/Hash))nodeon Kysely's internal AST)When
Effect.fninternally compares or hashes the returned value, it accesses these Symbol properties. The proxy returns a wrapped version instead of the actual value, triggering the invariant violation.Reproduction
The bug only manifests when using
Effect.fnbecause it performs internal operations (like hashing for tracing) that access Symbol properties on the returned Effect.