Hello.
I apologize for asking a question that has probably been answered a lot here but I have very little experience in the JS/Node world and am just starting to look at k6 as well.
I was trying to create a test suite that would test my IoT backend that uses the CoAP protocol (the simple explanation is that it’s binary HTTP on top of UDP). I found only one JS library that can do CoAP (GitHub - coapjs/node-coap: CoAP - Node.js style) and after following the instructions here I ended up trying to run npm run bundle
and got a bunch of “Module not found” errors.
I did see the notification in the documentation that NodeJS packages would possibly not work, especially it seems lower level modules (os, fs, net, etc) and that seems to be exactly my problem:
❯ npm run bundle |grep "Can't resolve"
Module not found: Error: Can't resolve 'net' in '/Users/stefan.freyr/work/pocs/coap/k6/node_modules/coap/dist'
Module not found: Error: Can't resolve 'crypto' in '/Users/stefan.freyr/work/pocs/coap/k6/node_modules/coap/dist/lib'
Module not found: Error: Can't resolve 'dgram' in '/Users/stefan.freyr/work/pocs/coap/k6/node_modules/coap/dist/lib'
Module not found: Error: Can't resolve 'crypto' in '/Users/stefan.freyr/work/pocs/coap/k6/node_modules/coap/dist/lib'
Module not found: Error: Can't resolve 'stream' in '/Users/stefan.freyr/work/pocs/coap/k6/node_modules/coap/dist/lib'
Module not found: Error: Can't resolve 'net' in '/Users/stefan.freyr/work/pocs/coap/k6/node_modules/coap/dist/lib'
Module not found: Error: Can't resolve 'dgram' in '/Users/stefan.freyr/work/pocs/coap/k6/node_modules/coap/dist/lib'
Module not found: Error: Can't resolve 'os' in '/Users/stefan.freyr/work/pocs/coap/k6/node_modules/coap/dist/lib'
My question is simply: Am I completely out of luck here? Is there any way for me to get this to work with k6?
I’ve tried to find a “pure” coap library that I could use but the node-coap
one is the only thing I’ve found so far.