fix(webdriver): guard Object.keys call on stringified request body#15221
Open
mnaoumov wants to merge 1 commit into
Open
fix(webdriver): guard Object.keys call on stringified request body#15221mnaoumov wants to merge 1 commit into
mnaoumov wants to merge 1 commit into
Conversation
In `_request()`, `fullRequestOptions.body` is already a JSON string (stringified in `createOptions()`). Calling `Object.keys()` on a large string enumerates every character index, causing V8 to throw `RangeError: Too many properties to enumerate` for large payloads. Add a `typeof fullRequestOptions.body === 'object'` guard so `Object.keys()` is only called on actual objects. Fixes webdriverio#15213
|
|
mnaoumov
added a commit
to mnaoumov/obsidian-integration-testing
that referenced
this pull request
Apr 29, 2026
browser.pushFile() in [email protected] throws RangeError on large payloads because FetchRequest._request() calls Object.keys() on a JSON string body. Replace per-file pushFile calls with a single tar.gz archive pushed via adb, which is both faster and sidesteps the bug entirely. The new flow: tar czf on host → adb push → tar xzf on device → cleanup. Requires deviceId in AppiumTransportConfig (already available in options). Upstream issue: webdriverio/webdriverio#15213 Upstream fix PR: webdriverio/webdriverio#15221 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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
_request(),fullRequestOptions.bodyis already a JSON string at that point (stringified earlier increateOptions()viaJSON.stringify(this.body)). CallingObject.keys()on a large string enumerates every character index as a property, causing V8 to throwRangeError: Too many properties to enumeratefor large payloads (e.g., large screenshots or file uploads).typeof fullRequestOptions.body === 'object'guard before theObject.keys()call so it only runs on actual objects, not strings.Root cause
Object.keys('...large string...')returns an array of character indices (['0', '1', '2', ...]). For strings with millions of characters, V8 cannot enumerate that many properties and throwsRangeError: Too many properties to enumerate.Fix
This ensures
Object.keys()is only called whenbodyis an actual object (which shouldn't happen in practice given the current flow, but guards against the string case safely).