Open Zacama opened 11 months ago
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
Hey there, what is the example $file.json
value? /root/generate/asyncapi/css/asyncapi.min.css
is a weird path
also, I understand that you tried running it just for one file, and all was fine?
@derberg
Hello. For example, there are five asyncapi files in a directory. file1.json, file2.json, file3.json, file4.json, file5.json.
for file in [file1.json, file2.json, file3.json, file4.json, file5.json]
do
asyncapi generate fromTemplate $file @asyncapi/html-template --param singleFile=true outFilename=$file.html --output ./generate --force-write & # (Adding this symbol ’&‘ allows the loop to continue executing instead of waiting here )
done
wait #(Wait here for all commands to be executed)
If there is only one file under the folder, the execution will not fail.
My guess is that during the execution of the commands, they used a temporary folder with the same name. When one of the
commands deleted the temporary folder and the other command tried to read the temporary folder, this error was issued.
temporary folder is used only if output
is not there -> https://github.com/asyncapi/cli/blob/master/src/commands/generate/fromTemplate.ts#L217C11-L217C20
I'm wondering if we might have a bug in html template. This is where the link from the error is coming from -> https://github.com/asyncapi/html-template/blob/master/template/index.html#L11-L16. But could be also issue with removal -> https://github.com/asyncapi/html-template/blob/master/hooks/01_removeNotRelevantParts.js
so the error pops up after first iteration, what is left on disk after error? is anything generated? if yes, then error with removal of css files, if not, then issue with including files inside html (I bet on this one)
Hello, I created a demo that can reproduce this problem: https://github.com/Zacama/asyncapi-generate-test. Those four API documents are the same, copy from https://studio.asyncapi.com/
This is the result of my execution in codespace
If output is a different folder, there is no problem
ok, then it is for sure related to current version of html template.
it runs on old generator rendering engine based on Nunjucks. It forces us to do some hacks for singleFile
parameter support. There is basically no conditional files generation, so we basically need to run such hooks after generation -> https://github.com/asyncapi/html-template/blob/master/hooks/01_removeNotRelevantParts.js#L25. So yeah, might happen that script tries to remove a file that was already removed by another run.
once https://github.com/asyncapi/html-template/pull/448 is merged (that introduces react rendering, that is much more flexible) we can easily implement an alternative solution for hooks.
but for now, you will have to generate into unique directory per generation, sorry about that
Okay, thank you~
Hello, I updated the version of the template to 1.0.0 and tried executing it again in the same working directory, and got the following error.
https://github.com/Zacama/asyncapi-generate-test
This issue has been automatically marked as stale because it has not had recent activity :sleeping:
It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.
There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.
Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.
Thank you for your patience :heart:
still relevant
Describe the bug
Parallel execution mulitple generate command
Command execution failure Generation Error: ENOENT: no such file or directory, open '/root/generate/asyncapi/css/asyncapi.min.css'
How to Reproduce
some asyncapi json files
Expected behavior
success