K6 custom extensions in k6 cloud?

Hello, all. I’m brand new to k6 and working on a POC, and I have a very basic question about running tests in the cloud.

When we run tests in the cloud (from the cli) do they run in vanilla k6 or do they somehow match what we are running locally? So will the test run in the same k6 version and with the same extensions that we are running locally?

Right now I’m wondering about using the xk6-websockets extension in the cloud. But I’m also curious about any custom extensions we may need to create in the future

Hey @dnise01

Thanks for posting in the forum!

Extensions are not supported in k6 Cloud out of the box at this time. When you trigger a test run in our infrastructure, we will deploy the latest k6 version to the load generator instances, in other words, we won’t automatically match the local version you are running.

With that being said, depending on your k6 Cloud subscription, we have the ability of deploying a custom k6 build/version to your account, but this is available only for Enterprise/Custom subscriptions at the time of writing this reply.

That unfortunately means that you won’t be able to run with xk6-websockets extension in your k6 Cloud test run.

Is there a particular feature/functionality in the websockets extension you are currently interested in?



Hi @dnise01, welcome to the community forum :tada:

While extensions are in general not availabel xk6-websockets is now available as an experimental module since v0.40.0

This means that you will need to import it as k6/experimental/websockets instead of k6/x/websockets.

Also as explained in the release notes this is experimental and we reserve the right to break this import path at any time. In particular when(there is no if here :wink: ) this no longer is an experiment we will remove that import path, likely with a version of warning but still.

Also of note is that xk6-websockets might change over time and we will merge this in k6 and deploy it to the cloud asyncrhonously to the actual release cycle of k6. Hopefully none of those changes will be breaking ones - just adding stuff. But this might happen.

Hope this helps you!

Thanks @viktor and @mstoykov for the info and warm welcome!

I’m using k6/ws now but since ws.connect is a blocking operation I’m not able to emulate my SignalR workflow correctly (e.g. connect, get a connection id, make http calls using the connection id while the websocket is open, close the connection).

I think xk6-websockets will eventually work better for me. However, I tested it this morning and ran into an issue with cookies not being passed and didn’t have a whole lot of luck setting them manually. I see that the cookies issue was already reported (here Support passing CookieJar to WebSocket through Params · Issue #1226 · grafana/k6 · GitHub ) so I’ll sit tight for now

The issue you linked is not about xk6-websockets but thje current k6/ws and is closed.

Are you having problems with k6/ws not being able to get the cookiejar ?

xk6-websockets unfortunately at all doesn’t have support for that yet.

I have opened Have a way to provide custom cookieJar per connection. · Issue #18 · grafana/xk6-websockets · GitHub and Add cookies from the default cookieJar just like `k6/ws` · Issue #17 · grafana/xk6-websockets · GitHub

Perfect, thank you!

And yeah, I included the wrong link. I was thinking of this one: Incomplete HEADER setup, Cookie missing from WS request headers · Issue #16 · grafana/xk6-websockets · GitHub and just saw your response to it, along with the new issues you created.