[Error] HTTP/2.0 500 Internal Server Error

Hi everyone!
Good day. Hope you and your family are doing well.
I’m new to k6 and I was doing some tool assessment for this (performance test).

I am trying out k6 for load testing and came across an issue. For all other APIs, it works fine but one endpoint is always giving 500 Internal Server Error via k6. It works fine with Postman by the way. Refer to screenshots below:

via kc cloud:

Hi @BizCover_johnc

Welcome to the community forum :wave:

I understand the second screenshot is from a local test with --http-debug="full", is that correct? And it’s not giving you clues as to what is missing in the k6 requests for this endpoint.

Could you share the Postman screenshot with all the settings for the endpoint that is giving you a 500 status with k6?

Also, can you run the same request with a curl -v, to showcase the response when you get a 200 vs. the k6 requests that fail?

We suspect there might be some headers missing in the k6 response and we should be able to compare those with what k6 is doing, and see if there is anything missing for that particular request.


Sorry for the late reply. But here is the one from postman:

Hi @BizCover_johnc

Thanks for sharing the screenshots, and no worries for the delay.

I would initially attempt to make sure the request headers are all there, to discard that the API is failing due to a missing header (like Accept: '*/*'), or values that are not exactly the same (Accept-Encoding). It could also help sending a token header as postman does, depending on how the API works.

Could you share the sanitized k6 script you are using, so we can check how you handle the cookies and the requests, and send the json body? Initially I suspected missing headers (since the requests that fail are the ones that would require handling a session), which could be fixed with dynamic correlation. However, those seem the same as Postman sends as far as I can see. And from the response your API returns (Object reference not set to an instance of an object), it could be that it does not recognize the productId sent?


A 500 Internal Server Error is a common error message that suggests an issue occurred on the server while processing a request. Resolving this error can be challenging due to the various potential causes. However, there are several steps you can take to address it. First, try refreshing the page or clearing your browser’s cache and cookies to eliminate temporary errors. If the error persists, attempting to access the website using a different browser might solve the problem. If none of these steps work, contacting the website’s administrator for assistance is recommended. Additional tips for troubleshooting a 500 Internal Server Error include checking the website’s status page for known issues, reviewing the website’s error logs to identify the underlying cause, and ensuring that your browser is up to date to ensure compatibility with the website.

1 Like