Trying to run K6 tests by importing Azure Node.js SDK modules for event grid. Used Webpack to transpile the libraries into a bundle and it first seems like it hung for a while and then fails with the following error.
Thanks for reporting this! I couldn’t reproduce this problem locally, I cloned your repo and built the script, but there is no 182220 in my app.bundle.js From the error, it sounds like this specific issue might be some incompatibility between JS regular expressions and the Go runtime we use to execute the scripts. Can you also push your generated app.bundle.js in the repo, so we can diagnose it?
In general though, unfortunately, k6 is never going to be able to execute all npm modules, especially ones that make external network requests. This wasn’t very well documented in our docs, so I’ve added an issue to fix it. Though even if this module somehow worked, another issue with it is that the resulting minifiedapp.bundle.js on my machine was over 2MB in size! This is going to slow k6 to a crawl, that’s why it “hung for a while” when it tried to parse it. k6 is a load testing tool, so overloading it is not a great idea if you want to get good results out of it.
As an alternative, I’d suggest using the Event Grid REST API directly. Skimming the docs, it seems simple enough and very straightforward: Azure Event Grid REST API | Microsoft Learn
Thanks for your response. Can we use Go SDK? Or is there a way to execute a JS script from inside of K6? Yes HTTP is an alternative, but I think K6 can make a good case if it enables SDK.
Also I take your point on how the tests should be lighter and not be taking time to load SDK’s.