Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 10.2.2 of mermaid-cli fails to generate a mindmap (puppeteer timeout or crashes) #556

Closed
kenseii opened this issue Jun 29, 2023 · 2 comments

Comments

@kenseii
Copy link

kenseii commented Jun 29, 2023

Describe the bug

After installing the latest version of mermaid-cli (10.2.2) and attempting to generate a mindmap svg using it, it always failed with a timeout error or sometimes a target crashed error. Puppeteer recently released 1.4.2 https://github.com/puppeteer/puppeteer/releases/tag/browsers-v1.4.2 and my guess is that this new update has some breaking changes

To Reproduce
Steps to reproduce the behavior:

  1. Install mermaid with npm npm install -g @mermaid-js/mermaid-cli
  2. Set your puppeteer config to look like this
{
  "headless": "new",
  "args": ["--disable-dev-shm-usage","--no-first-run","--disable-setuid-sandbox", "--no-zygote", "--disable-dev-shm-usage", "--disable-gpu"]
}
  1. run
cat << EOF  | mmdc -p puppeteer-config.json --input -
mindmap
  root(("午後4時9分"))
    "全体の概要"
        "エブリータイム4のニュースとスポーツ"
        "強盗事件の機金属店の東京上野での逮捕"
        "メイク持続シートによるメイクの密着ロック"
        "インディードで見つけた希望の仕事"
        "旅行のジャランスペシャルウィークプラン"
    "興味深い広告"
        "ハーゲンダッツのハロー幸せ"
        "密着ロックのメイク持続シート"
        "エムリーの綺麗なつづき"
    "逮捕の詳細"
        "実行役の2人が逮捕された強盗事件"
        "5月に発生した上野の機金属店"
        "ネックレスなどを強奪した後、男が逃走"
    "新製品とサービス"
        "アクエリアスの新しいウォーター"
        "カラッチョで糖や脂肪の吸収を抑える"
        "キリンの免疫ケアで内側から守る"
    "気象予報"
        "東京上野の非禁毒店で発生した冒頭事件"
        "2人の逮捕された男らの実行役"
        "61歳の男が韓国への究極の化粧品を作成"
        "岡場厳重警戒中"
EOF
  1. This command should take some time and finally return this error
  2. See the error
ProtocolError: Runtime.callFunctionOn timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
    at new Callback (file:///opt/homebrew/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js:58:35)
    at CallbackRegistry.create (file:///opt/homebrew/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js:103:26)
    at Connection._rawSend (file:///opt/homebrew/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js:212:26)
    at CDPSessionImpl.send (file:///opt/homebrew/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js:419:78)
    at ExecutionContext._ExecutionContext_evaluate (file:///opt/homebrew/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js:236:46)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (file:///opt/homebrew/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js:143:16)
    at async CDPJSHandle.evaluate (file:///opt/homebrew/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js:56:16)
    at async CDPElementHandle.$eval (file:///opt/homebrew/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/ElementHandle.js:86:24)
    at async renderMermaid (file:///opt/homebrew/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:237:22)

Expected behavior
The same command and config should fail on 10.2.2 but work if you run it using 10.1.0

Desktop (please complete the following information):

  • OS: MacOS and Ubuntu
  • Browser chrome and chromium
  • Version 113.0.5672.126(Official Build) (arm64)
@aloisklink
Copy link
Member

Thank you for the great and detailed bug report! I've tested and this actually seems to be a bug in Mermaid v10.2.2, see mermaid-js/mermaid#4408.

It's been fixed by Mermaid v10.2.3.

Unfortunately, we haven't yet made a new release of mermaid-cli yet. As a temporary measure, you can run npm install github:mermaid-js/mermaid-cli to install the latest in-development version on GitHub.

@MindaugasLaganeckas, can you make a v10.2.4 release to NPM, since Mermaid v10.2.4 has come out recently, see


By the way, "headless": "new" in my puppeteer config seems to be a bit buggy. It might be worth keeping the old "headless": true setting if you want a more stable experience, at least until the Puppeteer team improves the new headless mode.

@aloisklink
Copy link
Member

This has been fixed with @mermaid-js/mermaid-cli v10.2.4 (the puppeteer config file you gave doesn't seem to work, but using no puppeteer config file seems to be fine)!

Thanks again for raising this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants