Latest grafana/k6 image erroring at redis client creation

I’m using grafana/k6 image to run the load testing scripts created using k6. Recently with the latest image is having issues when creating new redis client.

time="2023-12-13T15:09:52Z" level=error msg="GoError: invalid options; reason: json: unknown field \"addrs\"\n\tat file:///drone/src/helpers/generateAccessToken.js:5:20(51)\n\tat go.k6.io/k6/js.(*requireImpl).require-fm (native)\n\tat file:///drone/src/pages/profile_page.js:3:0(35)\n" hint="script exception"

const redisClient = new redis.Client({
  addrs: new Array('127.0.0.1:6379')
});

This is working fine with ‘grafana/k6:0.47.0’ image.

Hi @sashi1!

With the release of k6 v0.48, there’s been an update to the Redis module that includes some breaking changes.

If you update your snippet to:

const client = new redis.Client('redis://127.0.0.1:6379');

You should be able to get rid of that exception. Here’s the docs page that includes more information on the new Client object: Client | Grafana k6 documentation

Please let me know if that works!

1 Like

Thank you so much. this works for me