Responses of GET requests seems to be empty when running in scenario mode

Hi!

I am currently facing a weird problem, which might not be described in the docs. I have GET calls, where I need the body of the response for the next call.

After some time in a scenario the response seems to be empty and parsing of the document is not possible. It looks like k6 is neglecting the responses (discardResponseBodies = false). When I had a look at the response they were just empty. It occurs in every scenario no matter what scenario type is configured.

The weird thing is that when running the exactly same script without scenario and with default function (standard mode), the script is running decent.

Error message:

My config:

export let options = {
scenarios: {
regular_api_test: {
executor: ‘ramping-vus’,
stages: [
{ duration: ‘2m’, target: 10 },
{ duration: ‘4m’, target: 40 },
{ duration: ‘2m’, target: 10 }
],
gracefulRampDown: ‘30s’,
exec: ‘regular’,
},
visit_transfer_api_test: {
executor: ‘constant-arrival-rate’,
rate: 5,
timeUnit: ‘1m’,
duration: ‘8m’,
preAllocatedVUs: 20,
maxVUs: 40,
exec: ‘visittransfer’
}
}
}

Is there something I did wrong in the configuration? Or could it be a possible bug?

Help is appreciated!

Hi @mma,

I would guess that you are getting either timeout requests due to the system under test or k6 not being able to handle the traffic. Or just any other kind of not expected status code (500 for example) which leads to the body being empty.

You can probably print the response in case of problems as in

try {
  res.json() 
} catch (e) {
  console.log(JSON.stringify(res, null, "  ")); 
}

and try to see what is happening