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/*.jsdoes 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/...?