ERRO[0000] ReferenceError: response is not defined

Hi Guys,

I am new to K6 and JavaScript, I have developed a script from k6 browser extension, when I try to execute the first request itself is failing with “ERRO[0000] ReferenceError: response is not defined”. I have not modified anything and there seems to be no issue with the request details, can someone please help resolving this.

Terminal Output:
scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

ERRO[0000] ReferenceError: response is not defined
at file:///C:/PT/K6%20-%20Scripts/Demo_API%20Script/CustomerSearch.js:28:37(23)
at*K6).Group-fm (native)
at main (file:///C:/PT/K6%20-%20Scripts/Demo_API%20Script/CustomerSearch.js:13:8(8)) executor=per-vu-iterations scenario=default source=stacktrace

Hi @ShivaShapelli

Welcome to the community forum :wave:

From what I understand, you have created the script using the k6 browser extension, do you refer to browser recorder, is that correct?

In the error we see a response is not defined from CustomerSearch.js, and I do not see that variable in your screenshot. So I’m not sure where it comes from. Can you provide a (sanitized) version of the full script in text format? That helps us reproduce and see where the errors comes from.

Thanks in advance for the additional information.


Hi @ShivaShapelli

As we discussed on the community slack, it would be great if you can shared the script CustomerSearch.js. It looks like response is not defined in the script when being used, at line 28.


Thanks for the follow-up, I worked in it the issue is resolved - its an issue with variable declaration.

1 Like