simonhaenisch / md-to-pdf

Hackable CLI tool for converting Markdown files to PDF using Node.js and headless Chrome.
https://www.npmjs.com/md-to-pdf
MIT License
1.15k stars 110 forks source link

ProtocolTimeout change via the Commandline #235

Closed vince-vibin closed 1 year ago

vince-vibin commented 1 year ago

Hi, I am using md2pdf in a Azure DevOps Pipeline. The file I'm trying to convert is pretty big (~23500 Lines in MD). I am running into a timeout issue and i haven't found documentation on how to change the Timeout from the commandline (a config file would be possible too).

Here is the specific error message:

ProtocolError: Page.printToPDF timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
    at <instance_members_initializer> (/usr/local/lib/node_modules/md-to-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:49:14)
    at new Callback (/usr/local/lib/node_modules/md-to-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:53:16)
    at CallbackRegistry.create (/usr/local/lib/node_modules/md-to-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:93:26)
    at Connection._rawSend (/usr/local/lib/node_modules/md-to-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:207:26)
    at CDPSessionImpl.send (/usr/local/lib/node_modules/md-to-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:416:33)
    at CDPPage.createPDFStream (/usr/local/lib/node_modules/md-to-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:848:50)
    at CDPPage.pdf (/usr/local/lib/node_modules/md-to-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:874:37)
    at generateOutput (/usr/local/lib/node_modules/md-to-pdf/dist/lib/generate-output.js:63:40)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async convertMdToPdf (/usr/local/lib/node_modules/md-to-pdf/dist/lib/md-to-pdf.js:61:20)
simonhaenisch commented 1 year ago

--launch-options '{ "protocolTimeout": 360000 }' or set launch_options in a config file (see readme).