Posit Connect Cloud repo deployment of Quarto/Shiny app generates incorrect static asset paths

Posit Connect Cloud repo deployment of Quarto/Shiny app generates incorrect static asset paths

We have a Quarto dashboard using Shiny for Python:

server: shiny
format:
  dashboard:
    theme: styles.scss
    include-in-header:
      - text: |
          <link rel="stylesheet" href="www/fonts.css">
      - text: |
          <script src="www/custom-behaviour.js"></script>
resources:
  - www/
...

The repo contains custom static assets under www/, including local fonts, CSS, JavaScript, and images. This works correctly when rendered locally with quarto render index.qmd and shiny run app.py, and has also worked historically when deploying to shinyapps.io via rsconnect deploy shiny .. I understand that rsconnect is currently still adding support for publishing to Posit Connect Cloud (issue #829).

Going through the existing repo integration process that exists within Posit Connect Cloud, however, when publishing the same GitHub repo directly with the Quarto framework (the Shiny framework does not work for this because there is no pre-rendered application file in the repo), the deployed app loads but the custom static assets do not appear to be served. The symptoms are:

  • Custom fonts fall back to the default sans-serif.
  • Custom JavaScript included from www/*.js does not run.
  • Browser-visible behavior suggests the www/ resources are not available at the URLs referenced by the generated HTML.

After downloading the Posit Connect Cloud deployed bundle and comparing it to a local render, the issue appears to be in the generated app.py.

The generated index.html still references assets like <link rel="stylesheet" href="www/fonts.css"> and <script src="www/custom-behaviour.js"></script>, but the generated Shiny static asset registry in app.py registers those files under paths like:

_static_assets = [
    "index_files",
    "cloud/project/www/fonts.css",
    "cloud/project/www/custom-behaviour.js",
    ...
]
_static_assets = {"/" + sa: Path(__file__).parent / sa for sa in _static_assets}

So the HTML requests /www/fonts.css, while Shiny appears to be serving/registering /cloud/project/www/fonts.css. In the downloaded bundle, the real files are present at www/fonts.css, not at cloud/project/www/fonts.css.

This suggests that Connect Cloud may be rendering the Quarto document from outside the project root, perhaps something like quarto render cloud/project/index.qmd, rather than changing into the project directory first, cd /cloud/project -> quarto render index.qmd.

The result is an internally inconsistent generated app: index.html uses project-relative www/... URLs, but app.py registers static assets with cloud/project/... prefixes.

Question: is this expected behavior for Quarto/Shiny repo deployments on Posit Connect Cloud, or is there a way to force the render working directory/project root so that static assets are registered as www/...?

Hello, looks like you have found a bug in our system, sorry about that! I have been able to reproduce this (thank you for the detailed description!) and have created an issue. We will get a fix out as soon as we can and I'll update this post once that happens.

thanks
sam

1 Like

Hi, we have released a fix for this issue. Please try again and let us know how it goes. Thanks for letting us know about it!

1 Like

Brilliant! All seems to be working as expected now! Cheers for such a prompt fix, @samp! :grin:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.