Hi all I am fairly new to k6 and currently having trouble opening a json file. I followed the examples provided here JavaScript API: open and can run this locally. But when trying to run this in aws I keep getting this error :
time="2022-08-08T14:09:52Z" level=error msg="GoError: stat /data.json: no such file or directory\n\tat go.k6.io/k6/js.(*InitContext).Open-fm (native)\n\tat file:///-:11:25(4)\n\tat file:///-:10:13(57)\n\tat native\n" hint="script exception"
My folder structure looks like this currently: Gen/proj/api/test/k6/
In this folder I have script.js and data.json
in script.js I have:
const data = new SharedArray('users', () => {
const f = JSON.parse(open('./data.json'));
return f;
});
would anyone be able to help me understand why i get that error ? Ive tried both relative and absolute paths. Ive tried with mounting and without mounting and still results in the same error. is there a specific import for invoking open() ?