fix: auth plugin loginAs injection broken in 4.x#5502
Open
Conversation
… of wrapping in non-callable Proxy The 4.x ESM migration changed Container.support(name) to always go through the proxy, which wraps values in lazyLoad() — a Proxy designed for page objects (property access), not callable functions. This broke the auth plugin's loginAs/login injection since the returned Proxy has no apply trap. Also fixes missing-key detection in inject.js (was never firing because lazyLoad always returns a truthy Proxy). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Container.support(name)to return plugin-injected functions directly instead of wrapping them in a non-callableProxy. The 4.x ESM migration changed this method to always go through the proxy'slazyLoad(), which createsnew Proxy({}, {...})— designed for page object property access, not for calling functions. This broke the auth plugin'sloginAs/logininjection.getandgetOwnPropertyDescriptorhandlers to also return functions directly (covers destructuring paths likecontainer.support()['loginAs']).inject.jsmissing-key detection:!objects[key]never fired becauselazyLoad()always returns a truthy Proxy. Changed to!(key in objects)which uses the proxy'shastrap.Root Cause
Container.support(name)was changed from:to:
The proxy's
lazyLoad()returnsnew Proxy({}, { get... })which has noapplytrap and target{}is not callable. Page objects work fine (they use property access), but injected functions (like auth'sloginAs) need to be called directly.Test plan
container.append({ support })is returned as a callable functioninject: "loginAs"🤖 Generated with Claude Code