Getting following error while running script on k6

WARN[0002] Request Failed                                error="Get \"https://test.k6.io\": http: server gave HTTP 
response to HTTPS client"
import http from 'k6/http';
import { sleep } from 'k6';

export default function () {
  http.request('GET','https://test.k6.io');
  sleep(1);
}

Hi @kalyanipawar

I was testing the same script as you and I do not get this error.

Can you tell us more about your platform? Do your requests go through a proxy? Are you running k6 with Docker? Do you get the same error with http.get('https://test.k6.io');?

If you can share the command you use and a bit more details about your environment, we might be able to help you troubleshoot.

Cheers!

Running script on local only using command
k6 run script.js

even able to launch same url “https://test.k6.io” on vm browser, but getting above issue with running with k6. running without docker only.

Hi @kalyanipawar

The next steps I would try:

  • curl https://test.k6.io from your VM. Does it work? My thinking is that the browser might have a proxy configured, for example. That allows the requests to reach https://test.k6.io.
  • What version of k6 are you running? You can check that with k6 version.
  • Try http.get('https://test.k6.io');, though I expect it will probably do the same.
  • Running k6 in debug might help you compare the request/responses. Execute k6 run --http-debug script.js. And compare with curl -v https://test.k6.io.

I hope this helps. It does seem to be an issue related to the VM having access to https://test.k6.io and somehow receiving a response that looks like it comes from http://test.k6.io. But it is difficult to tell without seeing your VM.

Cheers!

Hello,
K6 version : k6 v0.41.0 (2022-11-02T11:50:11+0000/v0.41.0-0-g11deb073, go1.19.3, windows/amd64)

Thanks you, seems some issue with vm certificates/ proxy.

1 Like

Hi @kalyanipawar

Thanks for coming back. I hope you can figure it out soon.

Cheers!