External module import problem

Hi guys,

We are using K6 for load-testing, but we stucked with a problem. If we import a module (like ‘jsonwebtoken’ or ‘jwk-to-pem’) into the js source file, then the test run will be killed by the running environment (after ~ 15 mins trying). Even if this is the only one thing what we put into the code.

Our guess is the generated js file is way too long and can not be properly processed - although it didn’t work with smaller splitted/chunked js files, so we aren’t sure. As far as we know it should have impact only on perfomance, but not being killed.

Do you have any idea what should we have to do?

How to replicate:

  1. clone the template project GitHub - grafana/k6-template-es6: Template repository for bundling test projects into single test scripts runnable by k6
  2. try to use jsonwebtoken in main.js (var jwt = require(‘jsonwebtoken’))

Thanks

Hey there, sorry about the late reply on this. @simme actually addressed this question live during k6 Office Hours, but to summarize, we think you might have more success with using the crypto package rather than an external one. You have probably already figured out an answer by now (in which case we’d also love to hear how you solved it), but if you haven’t, we’d be happy to help you out further here.

1 Like