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

Exception creating an Image using ELK and subgraph. #594

Open
hqv1 opened this issue Sep 15, 2023 · 3 comments
Open

Exception creating an Image using ELK and subgraph. #594

hqv1 opened this issue Sep 15, 2023 · 3 comments

Comments

@hqv1
Copy link

hqv1 commented Sep 15, 2023

Describe the bug
I'm attempting to create an SVG from a Markdown file containing a mermaid diagram. I'm using ELK as the default renderer. The CLI crashes at the Mermaid subgraph. It is able to create an SVG file if I remove the subgraph.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Markdown file with a mermaid diagram with ELK as the default renderer and with a subgraph. This is mine.
%%{init: {"flowchart": {"defaultRenderer": "elk"}}}%%
flowchart TB

subgraph hi
        a
end

Or without the mermaid code block

%%{init: {"flowchart": {"defaultRenderer": "elk"}}}%%
flowchart TB

subgraph hi
       a
end

Run the CLI mmdc -i input_diagram.md -o output.svg

This is the error I get

Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading 'children')
    at file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/dist/index.html:1358:3410
    at Array.forEach (<anonymous>)
    at M3e (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/dist/index.html:1358:3396)
    at file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/dist/index.html:1358:3507
    at Array.forEach (<anonymous>)
    at M3e (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/dist/index.html:1358:3396)
    at Object.fjt [as draw] (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/dist/index.html:1358:5185)
    at async Object.jDt [as render] (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/dist/index.html:88:840)
    at ExecutionContext._ExecutionContext_evaluate (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js:254:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js:143:16)
    at async CDPJSHandle.evaluate (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js:56:16)
    at async CDPElementHandle.$eval (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/common/ElementHandle.js:86:24)
    at async renderMermaid (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:246:22)
    at async file:///Users/xxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:442:41
    at async Promise.all (index 0)
    at async run (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:461:22)
    at async cli (file:///Users/xxxx/.nvm/versions/node/v18.7.0/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:184:3)

Expected behavior
I expect an SVG to be generated.

Desktop (please complete the following information):

  • OS: Mac
  • MMDC Version: 10.4.0
@bmitc
Copy link

bmitc commented Sep 16, 2023

I am seeing this issue as well. This is a critical issue since I am using Mermaid for automatically generated graphs that are large and complex, for which the elk renderer is essential as the default renderer can't handle the graphs well. I see the exception for any output format.

Also, the Mermaid Live Editor can't handle these type of graphs either.

image

In fact, the only way I have been able to even render these diagrams is with GitHub's Mermaid rendering in Markdown documents.

@phil-flip
Copy link

phil-flip commented Apr 15, 2024

Issue is still present, but a different error

@phil-flip
Copy link

After checking again, this issue doesn't seem to be present anymore. But there seems to be an issue with empty subgraphs. mermaid-js/mermaid#5402

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

3 participants