webdriverio: [πŸ› Bug]: v9 - Problems running tests on Browserstack

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.1.2

Node.js Version

20.17.0

Mode

WDIO Testrunner

Which capabilities are you using?

capabilities: [
    {
        browserName: 'Chrome',       
        'bstack:options': {
          browserVersion: '127.0',
          os: 'Windows',
          osVersion: '10',
        }
        
      }
  ],

  user: xxxxx,
  key: xxxxx,

  services: [
    [
      "browserstack",
      {
        browserstackLocal: true,
        testObservability: true,
        testObservabilityOptions: {
            projectName: "Your project name goes here",
            buildName: "The static build job name goes here e.g. Nightly regression"
        },
       
      },
    ],
  ],

What happened?

I tried updating from v.8.x to latest v.9 and ran into problems trying to run my tests using browserstack. I spoke to Erwin at Discord and he thought it might be related to https://github.com/webdriverio/webdriverio/pull/13701 and adviced me to submit a ticket. Please see logs below for relevant output regarding the error.

What is your expected behavior?

I should be able to connect to browserstack service

How to reproduce the bug.

Try running any tests using browserstack service to trigger the error. I have tried to adjust the flags but I always get the same error.

package.json

"@types/mocha": "^10.0.8",
"@wdio/browserstack-service": "^9.1.2",
"@wdio/cli": "^9.1.2",
"@wdio/local-runner": "^9.1.2",
"@wdio/mocha-framework": "^9.1.2",

Relevant log output

**WDIO logs:**

2024-10-01T05:07:15.689Z ERROR @wdio/browserstack-service: Data upload to BrowserStack Test Observability failed due to TypeError: fetch failed
2024-10-01T05:07:15.708Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
Error: spawn UNKNOWN
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at spawn (node:child_process:762:9)
    at Object.execFile (node:child_process:351:17)
    at C:\Projects\webdriverio-9\node_modules\browserstack-local\lib\Local.js:88:34
    at LocalBinary.binaryPath (C:\Projects\webdriverio-9\node_modules\browserstack-local\lib\LocalBinary.js:158:7)
    at Local.getBinaryPath (C:\Projects\webdriverio-9\node_modules\browserstack-local\lib\Local.js:259:19)
    at Local.start (C:\Projects\webdriverio-9\node_modules\browserstack-local\lib\Local.js:83:10)
    at node:internal/util:432:7
    at new Promise (<anonymous>)
    at bound  (node:internal/util:418:12)

**bstack-wdio-service.log;**

2024-10-01T05:18:43.162Z DEBUG @wdio/browserstack-service Exception in sending funnel data: TypeError: fetch failed
2024-10-01T05:18:43.162Z DEBUG @wdio/browserstack-service app is not defined in browserstack-service config, skipping ...
2024-10-01T05:18:45.984Z DEBUG @wdio/browserstack-service teardown started
2024-10-01T05:18:45.984Z DEBUG @wdio/browserstack-service teardown ended
2024-10-01T05:18:46.147Z DEBUG @wdio/browserstack-service Inside OnComplete hook..
2024-10-01T05:18:46.148Z DEBUG @wdio/browserstack-service Reading worker file worker-data-29044.json
2024-10-01T05:18:46.150Z DEBUG @wdio/browserstack-service Sending SDK event with data 

----

[90m2024-10-01T05:18:46.178Z DEBUG @wdio/browserstack-service Exception in sending funnel data: TypeError: fetch failed
2024-10-01T05:18:46.178Z INFO @wdio/browserstack-service If facing any issues, please contact BrowserStack support with the Build Run Id - xxxx
2024-10-01T05:18:46.207Z DEBUG @wdio/browserstack-service Failed to fire api request due to TypeError: fetch failed - TypeError: fetch failed
    at node:internal/deps/undici/undici:13178:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async nodeRequest (C:\Projects\webdriverio-9\node_modules\@wdio\browserstack-service\build\index.js:880:22)
    at async uploadLogs (C:\Projects\webdriverio-9\node_modules\@wdio\browserstack-service\build\index.js:1808:20)
    at async BrowserstackLauncherService._uploadServiceLogs (C:\Projects\webdriverio-9\node_modules\@wdio\browserstack-service\build\index.js:3327:22)
    at async BrowserstackLauncherService.onComplete (C:\Projects\webdriverio-9\node_modules\@wdio\browserstack-service\build\index.js:3203:7)
    at async file:///C:/Projects/webdriverio-9/node_modules/@wdio/cli/build/index.js:1207:9
    at async Promise.all (index 0)
    at async Launcher.run (file:///C:/Projects/webdriverio-9/node_modules/@wdio/cli/build/index.js:2198:7)
    at async Module.run (file:///C:/Projects/webdriverio-9/node_modules/@wdio/cli/build/index.js:3214:16)
2024-10-01T05:18:46.207Z DEBUG @wdio/browserstack-service Response - undefined

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 33 (14 by maintainers)

Most upvoted comments

@BosseKarat @h2grover @behnamazimi Not a problem. The fixed version has been released. Please check now.

@BosseKarat Raised https://github.com/webdriverio/webdriverio/pull/14122 to fix existing issues in WDIO Service. We will try with the fixes on above repo as well and fix if any additional issues.

@BosseKarat @h2grover @behnamazimi Meanwhile, could you please check if the branch solves the issues?

okay, let me create a sample repo for you

@behnamazimi App Upload issue is fixed in https://github.com/webdriverio/webdriverio/releases/tag/v9.2.2

@BosseKarat Let’s have a word via BrowserStack Support. They will reach out here and ask you to create a ticket.