-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
9.3.1
Node.js Version
v18.20.4
Mode
WDIO Testrunner
Which capabilities are you using?
{
"capabilities": {
"alwaysMatch": {
"platformName": "iOS",
"appium:deviceName": "iPhone(?! 11).*$",
"appium:platformVersion": "1[678]",
"wdio:specs": [
"../../src/tests/all/**/*.test.ts"
],
"bstack:options": {
"resignApp": false,
"projectName": "REDACTED",
"buildName": "REDACTED",
"sessionName": "REDACTED",
"debug": true,
"networkLogs": false,
"interactiveDebugging": false,
"appiumLogs": false,
"maskCommands": "setValues, getValues, setCookies, getCookies",
"wdioService": "9.3.0"
},
"appium:settings[snapshotMaxDepth]": 62,
"appium:settings[customSnapshotTimeout]": 0,
"appium:locale": "en_US",
"appium:app": "REDACTED"
},
"firstMatch": [
{}
]
}
}What happened?
When starting our wdio run, we sometimes have an error on the session init when calling https://hub-cloud.browserstack.com/wd/hub/session with the error below.
Right now, we are having difficulty pinpointing why, and the output [object Object] makes it more difficult to understand.
The output [object Object] format issue came from this line of code when err is an object. I suspect doing a JSON.stringify when it is an object helps figure out the content of our object in the below error stack case.
00:10:54.037 [0-19] 2025-05-05T05:20:54.058Z ERROR webdriver: Error: WebDriverError: Failed to fetch https://hub-cloud.browserstack.com/wd/hub/session: [object Object] when running "https://hub-cloud.browserstack.com/wd/hub/session" with method "POST" and args "REDACTED"
00:10:54.037 [0-19] at FetchRequest._libRequest (REDACTED/node_modules/webdriver/build/index.js:1474:15)
00:10:54.037 [0-19] at FetchRequest._request (REDACTED/node_modules/webdriver/build/index.js:1381:20)
00:10:54.037 [0-19] at startWebDriverSession (REDACTED/node_modules/webdriver/build/index.js:901:16)
00:10:54.037 [0-19] at Function.newSession (REDACTED/node_modules/webdriver/build/index.js:1625:41)
00:10:54.038 [0-19] at remote (REDACTED/node_modules/webdriverio/build/index.js:7736:20)
Note that I found the following similar case. We also suspect the root cause of the problem to be related to BrowserStack. We just need a better error output to have better clues about why it is happening.
- [🐛 Bug]: WebdriverIO fails making session requests to cloud vendors with long response times #13425
- [🐛 Bug]: Cannot run iOS specs on Browserstack after upgrade to wdio v9 #13477
What is your expected behavior?
Expected the error to output the content of [object Object]
How to reproduce the bug.
There are no clear steps to reproduce; this error is hard to encounter, occurring around 3-5 times per run of 300 tests.
Relevant log output
00:10:54.037 [0-19] 2025-05-05T05:20:54.058Z ERROR webdriver: Error: WebDriverError: Failed to fetch https://hub-cloud.browserstack.com/wd/hub/session: [object Object] when running "https://hub-cloud.browserstack.com/wd/hub/session"Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues