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

Unable to render quarto doc with shinylive app using custom Wasm CRAN #43

Open
DivadNojnarg opened this issue Oct 4, 2024 · 4 comments
Labels
bug an unexpected problem or unintended behavior documentation

Comments

@DivadNojnarg
Copy link

I am not sure where to open this issue, as it involves quarto, webr, rwasm and shinylive. I am facing a new issue which I did not have few weeks ago.

I want to render a quarto document including some shinylive demos. These demos need to pull a package from a custom wasm CRAN I maintain.

The GA workflow fails if I use a specific tagged version of my custom package:

# That's what I ask in the workflow file to install the right blockr version
- uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: |
            posit-dev/r-shinylive
            any::knitr
            any::rmarkdown
            any::downlit
            any::xml2
            any::shinyMobile
            BristolMyersSquibb/[email protected]
            any::pracma
          cache-version: 2

The error I get:

Error in `get_github_wasm_assets()`:
! Can't find WebAssembly binary assets for
  github::BristolMyersSquibb/[email protected]
! Ensure WebAssembly binary assets are associated with the GitHub release
  "v0.0.2.9023".
ℹ 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.

That's weird since the corresponding version should be available in my wasm CRAN. Besides, it just works fine in our pkgdown website which points to the same repo. The demo can also be found here.

I can also reproduce the error locally if I install the package with devtools::install_github("BristolMyersSquibb/[email protected]"). Fun fact: if I do devtools::install() from the blockr package project, I am able to compile the quarto document.

I followed what is written in the r-wasm instructions but now I am confused on how to move forward.

What did I do wrong?

@DivadNojnarg
Copy link
Author

It seems to me that shinylive wants me to provide the .tgz for blockr with my GitHub release assets (as written in the message). However, that's absolutely not what I want as they are already here: https://bristolmyerssquibb.github.io/webr-repos/bin/emscripten/contrib/4.4/blockr_0.0.2.9023.tgz in my custom wasm CRAN.

@georgestagg
Copy link
Member

georgestagg commented Oct 4, 2024

When you install directly from the GitHub remote BristolMyersSquibb/[email protected] using the extra-packages feature of r-lib/actions, the R Shinylive package is then unable to deduce the URL for your custom Wasm repository required to download the required binary for bundling with the application at build time. We can probably improve this, but for now that is the situation.

In theory, using something like the following in the GHA script should install the package directly from the custom Wasm repository, rather than from the source GitHub repo itself.

  run: Rscript -e 'install.packages("blockr", repos = "https://BristolMyersSquibb.github.io/webr-repos/")'

However, this does not seem to work because the source package https://BristolMyersSquibb.github.io/webr-repos/src/contrib/blockr_0.0.2.9023.tar.gz is missing -- That should not be the case, but I'm unsure right now what went wrong in the Wasm repo deployment to cause that.

In any case, you should be able to work around the issue for now by setting the SHINYLIVE_WASM_PACKAGES=0 environment variable before rendering your Quarto project. I think you can do that with:

      - name: Avoid bundling Shinylive packages
        run: echo "SHINYLIVE_WASM_PACKAGES=0" >> $GITHUB_ENV

@georgestagg
Copy link
Member

It seems to me that shinylive wants me to provide the .tgz for blockr with my GitHub release assets (as written in the message). However, that's absolutely not what I want as they are already [...] in my custom wasm CRAN.

Yes, this is a newer feature for Shinylive to aid in reproducibility of deployed applications by bundling static package assets with the app. It can be turned off using the SHINYLIVE_WASM_PACKAGES method above.

Sorry about the poor documentation here, we're still figuring out how to make all this work together well.

@DivadNojnarg
Copy link
Author

However, this does not seem to work because the source package https://BristolMyersSquibb.github.io/webr-repos/src/contrib/blockr_0.0.2.9023.tar.gz is missing -- That should not be the case, but I'm unsure right now what went wrong in the Wasm repo deployment to cause that.

Is it because of this:

Processing packages:
  ...
  /github/workspace/_site/src/contrib/blockr_0.0.2.9023_5f169ea.tar.gz
Run actions/upload-pages-artifact@v2
Run tar \
./
./src/
./src/contrib/
./src/contrib/blockr_0.0.2.9023_5f169ea.tar.gz

@georgestagg georgestagg added bug an unexpected problem or unintended behavior documentation labels Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior documentation
Projects
None yet
Development

No branches or pull requests

2 participants