How to change timeout in K6

Hi, madam/sir,

As I remember, default timeout value in K6 for request is 60 seconds.
And I want to know how can I change this timeout value globally because some of my requests require more time to wait.
My requirement is that after I change it globally and all requests can use this new value.
Could you please help me?

Thanks,
Ken

Hi @Ken

Thanks for the question, you do remember it well.

While it is true that the default timeout is 60 seconds for k6/HTTP, there are some ways to work around it:

Having the option to set an HTTP timeout globally depends on the implementation of the new HTTP API. As you can check in the public roadmap, it is currently on the long-term list, and we have the epic issue to implement it as a k6 extension that could later become core k6.

I encourage you to follow Option to set default HTTP configuration globally · Issue #761 · grafana/k6 · GitHub and k6 extension: New experimental HTTP API · Issue #2461 · grafana/k6 · GitHub. And :+1: to help prioritize them.

Also note that if you use k6 browser, we already have an option to set the timeout: setDefaultTimeout(timeout).

I hope this helps. Let us know if you still have questions or doubts.

Cheers!

Thank you so much eyeveebee, this really helps me a lot.

Thanks,
Ken

1 Like