asyncapi / asyncapi/html-template

[BUG] param pdf does not work with outFilename

Open Beginner friendly
#826 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
93
Forks
75
Avg merge
6m
Merged PRs (30d)
7

Description

### Describe the bug.

When I use the `param outFilename=foo` to define a custom filename together with `param pdf=true` the pdf generation throws an error and does not terminate:

```bash
$ asyncapi generate fromTemplate AsyncAPI.yaml @asyncapi/html-template --output ./tmp_html_pdf --param pdf=true outFilename=foo --force-write
WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
WARNING: See https://github.com/node-config/node-config/wiki/Strict-Mode
WARNING: No configurations found in configuration directory:/home/USER/AsyncAPI/config
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
(node:9564) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
┌ AsyncAPI Generator

◓ Generation in progress. Keep calm and wait a bit[BABEL] Note: The code generator has deoptimised the styling of /home/USER/.nvm/versions/node/v24.13.1/lib/node_modules/@asyncapi/html-template/template/js/asyncapi-ui.min.js as it exceeds the max of 500KB.
◓ Generation in progress. Keep calm and wait a bitPDF is generating...
◐ Generation in progress. Keep calm and wait a bit.Error: net::ERR_FILE_NOT_FOUND at file:////home/USER/AsyncAPI/tmp_html_pdf/index.html
at navigate (/home/USER/.nvm/versions/node/v24.13.1/lib/node_modules/@asyncapi/html-template/node_modules/puppeteer-core/src/cdp/Frame.ts:211:13)
at Deferred.race (/home/USER/.nvm/versions/node/v24.13.1/lib/node_modules/@asyncapi/html-template/node_modules/puppeteer-core/src/util/Deferred.ts:49:14)
at CdpFrame.goto (/home/USER/.nvm/versions/node/v24.13.1/lib/node_modules/@asyncapi/html-template/node_modules/puppeteer-core/src/cdp/Frame.ts:164:17)
at CdpPage.goto (/home/USER/.nvm/versions/node/v24.13.1/lib/node_modules/@asyncapi/html-template/node_modules/puppeteer-core/src/api/Page.ts:1773:12)
at generate:after (/home/USER/.nvm/versions/node/v24.13.1/lib/node_modules/@asyncapi/html-template/hooks/99_generatePdf.js:22:7)
at /home/USER/.nvm/versions/node/v24.13.1/lib/node_modules/@asyncapi/cli/node_modules/@asyncapi/generator/lib/generator.js:1021:14
at async Promise.all (index 0)
at Generator.executeAfterHook (/home/USER/.nvm/versions/node/v24.13.1/lib/node_modules/@asyncapi/cli/node_modules/@asyncapi/generator/lib/generator.js:368:5)
at Generator.generate (/home/USER/.nvm/versions/node/v24.13.1/lib/node_modules/@asyncapi/cli/node_modules/@asyncapi/generator/lib/generator.js:197:5)
at Generator.generateFromString (/home/USER/.nvm/versions/node/v24.13.1/lib/node_modules/@asyncapi/cli/node_modules/@asyncapi/generator/lib/generator.js:452:12)
◇ Check out your shiny new generated files at ./tmp_html_pdf # needs to be aborted with Ctrl-C
$ ls tmp_html_pdf
css js foo
```

### Expected behavior

Two entities:
- foo.html (+ css and js folders without singleFile)
- foo.pdf

### Screenshots

n/a

### How to Reproduce

```bash
asyncapi generate fromTemplate foo.yaml @asyncapi/html-template --output ./tmp_html_pdf --param pdf=true outFilename=foo
```

### 🖥️ Device Information [optional]

- Operating System (OS): WSL2
```bash
cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.3 LTS"
```

### 👀 Have you checked for similar open issues?

- [x] I checked and didn't find similar issue

### 🏢 Have you read the Contributing Guidelines?

- [x] I have read the [Contributing Guidelines](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md)

### Are you willing to work on this issue ?

No, someone else can work on it

Contributor guide

Open the contributing guide

Research direction

Start with the PDF after-generation hook shown in the trace, 99_generatePdf.js, and inspect how it locates the generated HTML when outFilename is set. Reproduce with the listed asyncapi generate command and verify that generation finishes with foo.html plus foo.pdf and the css and js folders.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.