My use-case is pretty niche but I want to run the archive command, untar that archive, make some changes to the files that are archived, and then re-archive it and run that re-archive.
Everything seems to be working fine until I try to run the re-archived test, I get an incredibly vague error:
FATA[0000] error="k6-test-api--local-imports-archive.tar:1:13 Expected \";\" but found \"\\x00\""
It seems like it’s interpreting the tar archive as an actual script file instead of an archive. I’m not totally sure as this is the only output I get, even with the verbose flag.
This was the command that generates that error:
k6 run --no-usage-report --summary-export output/k6/summary.json --out csv=output/k6/metrics.csv -v k6-test-api--local-imports-archive.tar
EDIT: This appears to be an issue with the archive? I generated a new k6 script.js and immediately archived it, and even that archive cannot run, with the same error.
Thanks for starting this thread. It sounds like a potential bug in the typescript extension. I’d like to try and replicate the issue on my side so that I can create a bug report if that is needed.
Could you please list all the commands you ran for the simple case where you generated a new k6 script.js, immediately archived it, and then the archive didn’t work with the error you mentioned in your first post?
These are the steps I tried with the latest v1.0.0 version of k6:
Created a new test:
import http from 'k6/http';
export default function() {
http.get('https://test.k6.io');
}
Ran k6 archive test.js, which created archive.tar.
Ran k6 run archive.tar which was successful in running the test.
As previously stated, yeah, that ts plugin seemed to be the culprit. After upgrading to 1.0.0 (and removing the plugin, since 1.0.0 now supports ts natively) running archives started to work again.
It’s important to note that the archive does create successfully, however, it just couldn’t run them.
The steps used were as follows (in any directory):
k6 new
k6 archive script.js
k6 run archive.tar
If I had to guess, the typescript extension maybe thought the tar file was a ts file, since they both start with t, causing it to try to interpret the archive as typescript? (That’s what the error seemed like anyway)