K6 Jenkins browser based error level=error msg="Uncaught (in promise) GoError: launching browser:

Hi everyone,

I tried to run k6-browser via jenkins build and below error will display.

+ K6_BROWSER_ENABLED=true k6 run browser-based/end2end/TCM-6275.js

          /\      |‾‾| /‾‾/   /‾‾/   
     /\  /  \     |  |/  /   /  /    
    /  \/    \    |     (   /   ‾‾\  
   /          \   |  |\  \ |  (‾)  | 
  / __________ \  |__| \__\ \_____/ .io

  execution: local
     script: browser-based/end2end/TCM-6275.js
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
           * browser: 1 iterations for each of 1 VUs (maxDuration: 10m0s, exec: browserTest, gracefulStop: 30s)

time="2023-08-02T04:17:12-07:00" level=error msg="Uncaught (in promise) GoError: launching browser: exec: no command\n\tat github.com/grafana/xk6-browser/browser.mapBrowserType.func2 (native)\n\tat file:///home/jenkins/workspace/Load%20Test/BrowserPostCase/browser-based/end2end/TCM-6275.js:17:40(9)\n\tat https://jslib.k6.io/k6chaijs/\n\tat go.k6.io/k6/js/modules/k6.(*K6).Group-fm (native)\n\tat dr (https://jslib.k6.io/k6chaijs/\n\tat browserTest (file:///home/jenkins/workspace/Load%20Test/BrowserPostCase/browser-based/end2end/TCM-6275.js:16:13(6))\n" executor=per-vu-iterations scenario=browser

     █ [TCM-6275] TCM-1: End to End Post a Case

     data_received........: 0 B 0 B/s
     data_sent............: 0 B 0 B/s
     group_duration.......: avg=854.85µs min=854.85µs med=854.85µs max=854.85µs p(90)=854.85µs p(95)=854.85µs
     iteration_duration...: avg=1.04ms   min=1.04ms   med=1.04ms   max=1.04ms   p(90)=1.04ms   p(95)=1.04ms  
     iterations...........: 1   257.455924/s

running (00m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
browser ✓ [ 100% ] 1 VUs  00m00.0s/10m0s  1/1 iters, 1 per VU
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

Hi @carlo,

This is probably because the pipeline runs in a container/agent that does not have chromium installed.

If you follow Load testing with Jenkins, I would try installing Chromium on the Jenkins job. Or, alternatively, make sure the agents that run those jobs have Chromium installed.

We see similar issues when running with Docker. The k6 image does not yet include chromium; you must install it. See Unable to run xk6-browser binary file inside Docker - GoError: launching browser: exec: no command - #3 by moonbridge. I created my own docker image for the browser to use on a GitLab pipeline a few days back: https://hub.docker.com/repository/docker/immavalls/browser-k6/general. In that one, I install chromium adding RUN apk update && apk add --no-cache chromium.

Make sure to also launch the browser the headless option to true.

I hope this helps. Let us know if you have further questions.


1 Like

Hi @eyeveebee

Thanks for your help, the jenkins build is running now.

1 Like