renderthis icon indicating copy to clipboard operation
renderthis copied to clipboard

Error in force(expr) : Failed to generate output in 30 seconds (timeout).

Open jorgesinval opened this issue 3 years ago • 2 comments

Hello!

I try to render a simple xaringan presentation:

---
title: "Example"
output: 
  xaringan::moon_reader:
    mathjax: "https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML"
---

# Introduction

with the this code:

renderthis::to_pdf(from = "example.Rmd",
                   to = "example.pdf")

but I keep receiving an error:

(¬_¬)renderthis::to_pdf(from = "example.Rmd",
...                    to = "example.pdf")
✔ Rendering example.Rmd into example.html ... done
✖ Rendering example.html into example.pdf ... failed
Error in force(expr) : Failed to generate output in 30 seconds (timeout).

However, if I remove:

    mathjax: "https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML"

it works:

(¬_¬)renderthis::to_pdf(from = "example.Rmd",
...                    to = "example.pdf")
✔ Rendering example.Rmd into example.html ... done
✔ Rendering example.html into example.pdf ... done

jorgesinval avatar Jun 24 '22 19:06 jorgesinval

There's an issue with that URL. Downloading it takes 15 seconds, opening it in a browser takes me about that long or longer. Maybe it's even slower in chromote?

system.time(
  download.file(
    "https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML",
    "mathjax.js"
  )
)
trying URL 'https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML'
downloaded 61 KB

   user  system elapsed 
  0.046   0.046  15.933 

You can try running this and adjusting wait time to see if it eventually completes.

to_html("example.Rmd")
pagedown::chrome_print("example.html", "example.pdf", wait = 45)

gadenbuie avatar Jun 24 '22 20:06 gadenbuie

Strangely, even after defining 120 seconds, I get:

(¬_¬)pagedown::chrome_print("example.html", "example.pdf", wait = 120)
Error in force(expr) : Failed to generate output in 30 seconds (timeout).

So, the error mentions 30 seconds.

jorgesinval avatar Jun 27 '22 12:06 jorgesinval