GoError: invalid URL value '<nil>'

while running a K6 script I get an error
ERRO[0007] Engine error hint="GoError: invalid URL value '<nil>' at github.com/loadimpact/k6/js/common.Bind.func1 (native)"

I ran the script with --http-debug=“full” but didn’t see any extra info. How to debug?

I have 3 dozen URLs in the script

Hi @aakash.gupta ,
By the looks of it instead of providing a URL string you provide a null to some HTTP call.
I ran

import http from "k6/http";

export default function() {
    http.get(null);
}

which produced

ERRO[0000] GoError: invalid URL value '<nil>'
        at github.com/loadimpact/k6/js/common.Bind.func1 (native)
        at file:///home/mstoykov/work/loadimpact/k6/t.js:4:24(5)  executor=per-vu-iterations scenario=default source=stacktrace

with k6 v0.30.0. as you can see you see that this happens on line 4 of t.js (the last line).

Are you missing that last line? what version of k6 are you running if so?

I didn’t get the last line.

I am running k6 0.30.0.

The error I am getting is 0007 and @mstoykov yours in 0000

from that I can only guess that you are calling http.get/post from the init context which is forbidden, but unfortunately you don’t get to the part that checks that. Also unfortunately stacktraces in the init context aren’t there

This is the timestamp at which it happens, not a code of an error :wink:

I fixed the error. I was lucky the bad URL was in the beginning of the script. I am getting another error i.e. GoError: cannot parse json due to an error. The problem I am seeing is that there is mention of the line it is failing at.