asyncapi / github-action-for-cli

GitHub Action with generator, validator, converter and others - all in one for your AsyncAPI documents with AsyncAPI CLI as backbone
Apache License 2.0
46 stars 19 forks source link

Github action creating pdf fails because of puppeteer #329

Closed oliverunger closed 10 months ago

oliverunger commented 1 year ago

Describe the bug

Generator fails to create asyncapi pdf

How to Reproduce

Using the following step:

Github Actions Log: PDF is generating... Error: Failed to launch the browser process! spawn /node_modules/@asyncapi/generator/node_modules/puppeteer/.local-chromium/linux-1002410/chrome-linux/chrome ENOENT

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

at onClose (/node_modules/@asyncapi/generator/node_modules/puppeteer/src/node/BrowserRunner.ts:304:[9](https://github.com/XXX/XYZ/actions/runs/6024020451/job/16341900878#step:7:10))
at ChildProcess.<anonymous> (/node_modules/@asyncapi/generator/node_modules/puppeteer/src/node/BrowserRunner.ts:296:16)
at ChildProcess.emit (node:events:513:28)
at ChildProcess.emit (node:domain:489:[12](https://github.com/XXX/XYZ/actions/runs/6024020451/job/16341900878#step:7:13))
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:485:[16](https://github.com/XXX/XYZ/actions/runs/6024020451/job/16341900878#step:7:17))
at processTicksAndRejections (node:internal/process/task_queues:83:21)

Expected behavior

Should create a beautiful pdf of my asyncapi.

github-actions[bot] commented 1 year 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.

derberg commented 1 year ago

@oliverunger thanks for the report, can you confirm, did you try to generate PDF without GitHub action? did it work?

github-actions[bot] commented 1 year 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.

derberg commented 1 year ago

might be that we need to improve https://github.com/asyncapi/github-action-for-generator/blob/master/Dockerfile and follow what we did in https://github.com/asyncapi/generator/blob/master/Dockerfile (so have puppeteer dedicated config).

@oliverunger can you open a PR?

oliverunger commented 1 year ago

Hello @derberg Thank you for your quick response! Using asyncapi generate fromTemplate my_asyncapi.yml @asyncapi/html-template@0.28.0 -p pdf=true singleFile=true worked well and generated a .pdf and a .html for me with the following logs:

PDF is generating...
PDF generated!
Generation in progress. Keep calm and wait a bit... done
Check out your shiny new generated files at C:\git-repos\myproject.
oliverunger commented 1 year ago

This worked for me in my github workflow but its suboptimal:

      - name: Install Asyncapi generator
        run: npm install -g @asyncapi/generator

      - name: Generating PDF from my AsyncAPI document
        run: ag my_asyncapi.yml @asyncapi/html-template@0.28.0 -p pdf=true singleFile=true -o wiki/diagrams

Very bad: The generated pdf is full expanded. Good: Links are clickable

derberg commented 1 year ago

The fact that PDF is fully expanded was done intentionally. I'm not a PDF expert and assumption was it must be expanded, otherwise generated PDF will be "broken" as we were not sure expand/collapse will work + cntrl + f will not work

derberg commented 10 months ago

looks like fixed.

if there is a strong and clear vision how to improve PDF, please open an issue in https://github.com/asyncapi/html-template