quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.95k stars 326 forks source link

Failing to call puppeteer for mermaid png in release build w/ deno 1.33.1 #5417

Closed jjallaire closed 1 year ago

jjallaire commented 1 year ago

Bug description

For this document:

---
title: "Mermaid"
format:
  html: 
    mermaid-format: png 
---

```{mermaid}
%%| echo: fenced
flowchart LR
  A[Hard edge] --> B(Round edge)
  B --> C{Decision}
  C --> D[Result one]
  C --> E[Result two]

I see this error:

```text
jjallaire@jjallairesMBP2 julia-cwd % quarto preview /Users/jjallaire/quarto/bugs/julia-cwd/subdir/mermaid.qmd --no-browser --no-watch-inputs
ERROR: TypeError: Relative import path "puppeteer/mod.ts" not prefixed with / or ./ or ../

TypeError: Relative import path "puppeteer/mod.ts" not prefixed with / or ./ or ../
    at async getPuppeteer (file:///Applications/quarto/bin/quarto.js:35175:24)
    at async fetcher (file:///Applications/quarto/bin/quarto.js:35304:22)
    at async getBrowserExecutablePath (file:///Applications/quarto/bin/quarto.js:35308:28)
    at async criClient (file:///Applications/quarto/bin/quarto.js:35694:28)
    at async file:///Applications/quarto/bin/quarto.js:35677:22
    at async Semaphore.runExclusive (file:///Applications/quarto/bin/quarto.js:35361:29)
    at async Object.createPngsFromHtml (file:///Applications/quarto/bin/quarto.js:35858:44)
    at async makePng (file:///Applications/quarto/bin/quarto.js:62939:72)
    at async Object.cell (file:///Applications/quarto/bin/quarto.js:63004:20)
    at async Promise.all (index 0)

In development mode it still fails but I see a different behavior. The 'Check file' for puppeteer is called and then hangs:

jjallaire@jjallairesMBP2 julia-cwd % quarto preview /Users/jjallaire/quarto/bugs/julia-cwd/subdir/mermaid.qmd --no-browser --no-watch-inputs
Check file:///Users/jjallaire/quarto/quarto-cli/src/resources/vendor/deno-land/x/puppeteer@9-0-2/mod.ts

Checklist

nirvdrum commented 1 year ago

If it helps at all, I see something similar with format: pptx, but not format: revealjs.

cscheid commented 1 year ago

This should be fixed on main now. @jjallaire can you confirm? Thanks.

It was a combination of a bad polyfill on our side and a Deno 1.33 bug that was fixed on 1.33.2.

jjallaire commented 1 year ago

Can confirm that it now works!

I do see this message in the terminal the first time I invoke it:

Check file:///Users/jjallaire/quarto/quarto-cli/src/resources/vendor/deno-land/x/puppeteer@9-0-2/mod.ts

Is that expected?

During testing I also noticed that our YAML schema for mermaid-format is wrong (there is no completion for mermaid-format at the top level or within a format). e.g. the following gives no completions when typing mermaid-format:

---
title: "Untitled"
format: 
  html:
    mermaid: 
      theme: default
    mermaid-format: png
---
cscheid commented 1 year ago

Check file:///Users/jjallaire/quarto/quarto-cli/src/resources/vendor/deno-land/x/puppeteer@9-0-2/mod.ts

I unfortunately haven't been able to figure out how to turn that off :/ It goes away after the first check because the typechecking is now cached by deno. But I would like that to stop as well, I just don't understand why it happens. (I don't think it would happen with --no-check in the releases, though)

During testing I also noticed that our YAML schema for mermaid-format is wrong (there is no completion for mermaid-format at the top level or within a format). e.g. the following gives no completions when typing mermaid-format:

I'll investigate and followup.

nirvdrum commented 1 year ago

I'm still seeing the problem in 1.4.87 the presentation format set to pptx. Is that line built off a different branch? Should I open a different issue?

Steinthal commented 1 year ago

I still get the error with Quarto version 1.4.104 for PDF output:

ERROR: TypeError: Relative import path "puppeteer/mod.ts" not prefixed with / or ./ or ../

Stack trace:
    at async getPuppeteer (file:///Applications/quarto/bin/quarto.js:35255:24)
    at async fetcher (file:///Applications/quarto/bin/quarto.js:35384:22)
    at async getBrowserExecutablePath (file:///Applications/quarto/bin/quarto.js:35388:28)
    at async criClient (file:///Applications/quarto/bin/quarto.js:35774:28)
    at async file:///Applications/quarto/bin/quarto.js:35757:22
    at async Semaphore.runExclusive (file:///Applications/quarto/bin/quarto.js:35441:29)
    at async Object.createPngsFromHtml (file:///Applications/quarto/bin/quarto.js:35938:44)
    at async makePng (file:///Applications/quarto/bin/quarto.js:60159:72)
    at async makeDefault (file:///Applications/quarto/bin/quarto.js:60217:24)
    at async Object.cell (file:///Applications/quarto/bin/quarto.js:60240:20)
zkamvar commented 1 year ago

I am getting this error with version 1.4.112 when trying to build a quarto book with mermaid diagrams (in intro.qmd): link to failing github workflow run in carpentries/workbench-dev.

I am still able to preview the site, however.

The weird thing is that I am able to build a site containing nearly the same content (contributing/index.qmd): link to successful github workflow run in carpentries/workbench

When I try this on the test file that JJ provided, I get the error on preview.

cscheid commented 1 year ago

I can repro these. I'm investigating. I don't understand why this doesn't happen with our dev version pinned to the same commit as the release.

In the meantime, if you must use puppeteer, I recommend following the instructions in https://github.com/quarto-dev/quarto-cli#development-version and adding git checkout v1.4.112 (or whichever version you want) before running ./configure.sh.

zkamvar commented 1 year ago

In the meantime, if you must use puppeteer, I recommend following the instructions in https://github.com/quarto-dev/quarto-cli#development-version and adding git checkout v1.4.112 (or whichever version you want) before running ./configure.sh.

I installed v1.4.122 using the deb file and the github actions appears to do the same. I just assume that the dependencies are provisioned already in the deb.

cscheid commented 1 year ago

This is sausage to me.

Just to make sure everyone here is on the same page, there's no need for that kind of language; we're responding as fast as we can. Thank you.

zkamvar commented 1 year ago

I apologise for that and I understand and appreciate the work you are doing for this. I have removed the comment.

cscheid commented 1 year ago

I tested a fix to v1.4.112 that should work in the next releases. We're building the next version (v1.4.113 likely) now and that should be available soon. Please let me know if this doesn't address your issue and we'll reopen.

zkamvar commented 1 year ago

I have rerun the action and can confirm that the dev version now works: https://github.com/carpentries/workbench-dev/actions/runs/5145970163/jobs/9264358468

Thank you for your quick response on this!