K6 post request timeout while curl works

I have a grafana server on which I would like to perform load test on it,
in the setup(), I would like to make an API call to the grafana’s API endpoint to create a viewer token, then in the default function, I would like to send requests to the grafana server using the API generated in the previous steps, here is my piece of code:

export function setup() {
	const url = 'https://grafana.domain';
	const params = {
		headers: {
			'Authorization': 'Bearer AAA',
			'Accept': 'application/json',
			'Content-Type': 'application/json',
	const payload = JSON.stringify({
		name: 'dNN7Q',
		role: 'Viewer',
		secondsToLive: 1200,
	const tmptoken = http.post(`${url}/api/auth/keys`, payload, params);
  	return {tokendata:tmptoken.json() };


But when I run k6 run --http-debug=full script.js, I get the below error:

INFO[0000] Request:
POST /api/auth/keys HTTP/1.1
Host: grafana.domain
User-Agent: k6/0.37.0 (https://k6.io/)
Content-Length: 53
Accept: application/json
Authorization: Bearer AAA
Content-Type: application/json
Accept-Encoding: gzip

{"name":"dNN7Q","role":"Viewer","secondsToLive":1200}  group="::setup" iter=0 request_id=5c828d3b-6380-48d3-51f0-ab773589f8f7 source=http-debug vu=0

Run       [======================================] setup()
default   [--------------------------------------]
ERRO[0063] setup() execution timed out after 60 seconds  hint="You can increase the time limit via the setupTimeout option"

But when I send this request using CURL everything works as expected:

curl --request POST  -H 'Authorization: Bearer AAA' -H 'Content-Type: application/json' -H 'Accept: application/json' https://grafana.domain/api/auth/keys -d '{"name":"dNN7Q","role":"Viewer","secondsToLive":1200}'


Hi @yasharne , welcome to the community forum :tada:

Just from this info I have to ask you:

  1. how long does the curl command take
  2. does increasing the setupTimeout and the request timeout(search for timeout in the page) help?

I would also look at curl -v output to see what curl actually sends to see if it sends something on top of that :person_shrugging: