cynkra / cynkrablog

Source of the cynkra blog
https://cynkra.com/blog
0 stars 1 forks source link

Unable to render shinylive examples #57

Open DivadNojnarg opened 3 months ago

DivadNojnarg commented 3 months ago

@christophsax: a summary of my investigations so far.

The shinyMobile blog post isn't rendering anymore on CICD and locally. Locally, the examples don't show any shinylive app but the code instead.

Screenshot 2024-07-29 at 22 44 42

What I have locally after updating shinylive R package (now):

shinylive::assets_info()
shinylive R package version: 0.2.0
shinylive web assets version: 0.5.0
...

When I render the qmd doc I get:

GET: /posts/2024-05-13-shinyMobile-2.0.0/index.html
  /posts/2024-05-13-shinyMobile-2.0.0/shinylive.js (404: Not Found)
GET: /posts/2024-05-13-shinyMobile-2.0.0/index.html
  /posts/2024-05-13-shinyMobile-2.0.0/shinylive.js (404: Not Found)

When shinylive is used with embed-resources: true, the original code chunk is shown in full instead of the shinylive app.

Weird because toggling this option does not change anything.

All in all, this seems to be a collection of individual changes causing this issue: shinylive quarto extension, quarto, shinylive R package, ...


Extra remarks:

DivadNojnarg commented 3 months ago

On a side note, with this new feature, we might not need the quarto shinylive extension anymore:

pak::pak("parmsam/r-shinylive@feat/encode-decode-url")
pak::pak("lzstring")

# Create a toy app in a folder and call shinylive:::url_encode_dir
shinylive:::url_encode_dir("APP_DIR")

# Which gives a ready to use URL to be embedded in an iframe.

https://shinylive.io/r/editor/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKAZwAtaJWAlAB0IdJiw48+rALJF6tanGEQRU-gEF07EQAJdAV1q6AvLoBmAdgAKUAOZwdEffqsBlPnaUAZKKyIGpE4uLtAAbvQsphaWAHJQESzspLSkStFCYACSEKiBnBZEjDCZArh6ITEAQtREBADW7FZVgaQkOmAGqAAmUOSZuLqZAMJ0DbrwpWUVIc21DQAqqUodGrp0nKS6ROa6fHmkBXy6UIXFpeXOlVbetJvBlfp8nHBbZgtYAKoAopeP+t1aGFaN04IwCmYAGIabxuX4zSqbRgkOzRD4-P7-KyQoowB7-PbdDJgGCscy4gYIx5WBZwAAeQSp-32gSyRLMmXIDMpVwJ+moUHocGoxNpDL2uUCPL5LjCUGoBjgxLcRHgui5pGlMt0qAFBDg3CI1FBjGJAE0AqaNbpuGC4FqZZtWOkzBtGbztaDOARGLRUCkSMS1sQjer6VsWZq8EyCQE0nwle8vvCPTL4IDTmYrFliBAOoaDC8LjH-gQlCxBS7dOiU9qXOZan1PGjkyWQioZdNU9dLGLSBpGHAoPi+ZG2cSNSwhw6+QKhSKOWA+7oB9Po93HnKFYmhmBvEU4DA9qhOAYj90jUVdJxUid4KRBrmXgRyKQDIw25UoIDUHcCM3hVSQYXiJC9dDgWhCxgIgiXIGBUCvPh-0BboDDIQxNQ3f45wPcCtgvWpBwmexoBOOgAEcDCgGcCV1KB9UNY0wXNS0w3FW1Bxo-5BxvAAvHca0xR1SGdHc3RHGUvR9P0A2cRdgyIUNrUjLjY0COgIAE5MhO1dNaEzGIc3aTICyLMAuzrfQyyHZh6CrQTP1mRsUggVEkx+RzdA7PkLL5KxbE4TgAHcim6CTmUlUhx0XVAoECkLGG6VTKjnYViQC4LQsQZKQjohijRNFj3x1OLMsSm07RylwnSrcTPIBOBvV9f1aEDeTdBDEVlMiqqQjjDStIxeqJjgDNomzXN8wCMzfLrayKzswba0shsiCbVyWw8rD20-bzHj2lxZtlMFIhSGA+wAeUCA4OnJc5zIRbzfJeRgwmYrM0JfVq80jQY4wOYDGpvEgBF0EAEX+wIABI7qPAAeABaXRBwgE1rF9Mh2EjKHSVhlQIfoF63u+N7MexrpenIQZwe7Cm+jgSFLBxYpwv0TJcYpdcCUpgy6u23cNUyYlYjgIK2KjHTHk5cMp2osBhdF8WTkHOXJcqTJYvi0KhcXEWxc1sqkrAEsDv0A6AF9vPNkQVDAc2AF0gA
maelle commented 1 month ago

Our CICD workflow pulls the latest quarto: 1.6.x. Maybe we should fix it to always get predictable output.

This makes perfect sense.

Are the errors for both render and preview?

DivadNojnarg commented 1 month ago

Are the errors for both render and preview?

Yes.

TBH I don't know what to think about the quarto shinylive extension. I am currently writing a new blog post but don't manage to render it. I now got this new kind of error for non CRAN packages, which complains about a mismatch between assets versions. The point is our custom wasm CRAN repo has packages with the correct tag versions: https://github.com/BristolMyersSquibb/webr-repos/blob/main/packages#L21, so I don't really get what's wrong (I am all up to date, cleared all the caches, reinstalled everything, ...)

Error in `get_github_wasm_assets()`:
! Can't find WebAssembly binary assets for
  github::BristolMyersSquibb/blockr@v0.0.2.9010
! Ensure WebAssembly binary assets are associated with the GitHub release
  "v0.0.2.9010".
ℹ WebAssembly binary assets can be built on release using GitHub Actions:
  <https://github.com/r-wasm/actions>
ℹ Alternatively, install a CRAN version of this package to use the default Wasm
  binary repository.
Backtrace:
     ▆
  1. └─shinylive:::quarto_ext()
  2.   └─shinylive:::build_app_resources(app_json)
  3.     ├─withr::with_options(...)
  4.     │ └─base::force(code)
  5.     └─shinylive:::download_wasm_packages(...)
  6.       └─base::lapply(...)
  7.         └─shinylive (local) FUN(X[[i]], ...)
  8.           └─shinylive:::prepare_wasm_metadata(pkg, prev_meta)
  9.             └─shinylive:::get_github_wasm_assets(desc)
 10.               └─cli::cli_abort(...)
 11.                 └─rlang::abort(...)
Warning message:
In find.package(pkgs, lib.loc = NULL, quiet = FALSE, !is_quiet()) :
  there is no package called ‘webr’
Execution halted
(E) Error running 'Rscript' command. Perhaps you need to install / update the 'shinylive' R package?

The irony is that it works perfectly from the shinylive app, no matter the tag version or whatever.