tlsAuth option in the config file not working


I have a config file in the same level as my test scripts. Adding tlsAuth as options directly in the test script works fine and it finds the certificate. However, if I have the same tlsAuth option in a config file, it doesn’t work. I get the following error:

ERRO[0001] tls: failed to find any PEM data in certificate input

Any idea why?


You’re probably adding the path to the file in the JSON config, while k6 expects the actual key string contents. Not sure if you’re the same person, but I just answered a similar question with more details on StackOverflow: javascript - k6 - tlsAuth in config file with *.crt files - Stack Overflow