quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.88k stars 318 forks source link

Unable to publish to netilfy from RStudio Cloud #1567

Closed kippandrew closed 2 years ago

kippandrew commented 2 years ago

Bug description

Attempting to publish to Netlify from RStudio Cloud via the RStudio Workbench terminal currently does not work:

/cloud/project/myblog$ quarto publish netlify
? Authorize (Y/n) › Yes
[403:403:0728/174441.766121:ERROR:ozone_platform_x11.cc(247)] Missing X server or $DISPLAY
[403:403:0728/174441.766172:ERROR:env.cc(226)] The platform failed to initialize.  Exiting.
/usr/bin/xdg-open: 869: firefox: not found
/usr/bin/xdg-open: 869: iceweasel: not found
/usr/bin/xdg-open: 869: seamonkey: not found
/usr/bin/xdg-open: 869: mozilla: not found
/usr/bin/xdg-open: 869: epiphany: not found
/usr/bin/xdg-open: 869: konqueror: not found
/usr/bin/xdg-open: 869: chromium: not found
/usr/bin/xdg-open: 869: chromium-browser: not found
[454:454:0728/174441.859915:ERROR:ozone_platform_x11.cc(247)] Missing X server or $DISPLAY
[454:454:0728/174441.859962:ERROR:env.cc(226)] The platform failed to initialize.  Exiting.
/usr/bin/xdg-open: 869: www-browser: not found
/usr/bin/xdg-open: 869: links2: not found
/usr/bin/xdg-open: 869: elinks: not found
/usr/bin/xdg-open: 869: links: not found
/usr/bin/xdg-open: 869: lynx: not found
/usr/bin/xdg-open: 869: w3m: not found
xdg-open: no method available for opening 'https://app.netlify.com/authorize?response_type=ticket&ticket=2b3242e1811b5d6fee5970013c7b8a1d'

I believe the issue is that quarto is not detecting the RStudio Workbench (Prairie Trillium) environment correctly when quarto is invoked from the terminal. See https://github.com/quarto-dev/quarto-cli/blob/90c7f3ba42ffdae3c2b13ad3d1814f8aaaa14b9f/src/core/platform.ts#L32:L35

The issue may be that the expected ENV vars are not present in the terminal session, so quarto is attempting to open a native browser window which fails due to lacking a display.

/cloud/project/myblog$ env | grep RS_
RS_RPOSTBACK_PATH=/usr/lib/rstudio-server/bin/rpostback
RS_SESSION_TMP_DIR=/var/run/rstudio-server/rstudio-rsession
RS_SERVER_RPC_SOCKET_PATH=/var/run/rstudio-server/rstudio-rserver/session-server-rpc.socket
RS_SERVER_LOCAL_SOCKET_PATH=/var/run/rstudio-server/rstudio-rserver/rserver.socket
RS_MONITOR_SOCKET_PATH=/var/run/rstudio-server/rstudio-rserver/rserver-monitor.socket
RS_SERVER_TMP_DIR=/var/run/rstudio-server/rstudio-rserver

Example project running on RStudio Cloud: https://rstudio.cloud/content/4302652

quarto check Output

/cloud/project/myblog$ quarto check

[✓] Checking Quarto installation......OK
      Version: 1.0.35
      Path: /opt/quarto/1.0.35/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.8.10
      Path: /usr/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.2.1
      Path: /opt/R/4.2.1/lib/R
      LibPaths:
        - /cloud/lib/x86_64-pc-linux-gnu-library/4.2
        - /opt/R/4.2.1/lib/R/library
      rmarkdown: 2.14

[✓] Checking Knitr engine render......OK

quarto tools check Output

/cloud/project/myblog$ quarto tools check
[✓] Inspecting tools

Tool         Status            Installed     Latest  
chromium     Not installed     ---           869685  
tinytex      Not installed     ---           v2022.07

Checklist

kippandrew commented 2 years ago

Original post: https://community.rstudio.com/t/publish-a-quarto-blog-to-netlify-from-rstudio-cloud/143273/3

jthomasmock commented 2 years ago

Ran into this error today via quarto publish quarto-pub as well, will upvote!

jjallaire commented 2 years ago

Note that in v1.1 we now detect server environments and just print the URL instead (we may be able to backport this fix but we haven't yet nominated fixes for backporting).

kippandrew commented 2 years ago

Another user reported a similar issue publishing to Quarto Pub:

https://community.rstudio.com/t/logging-in-and-publishing-to-quarto-pub/143511/3

jjallaire commented 2 years ago

This is fixed in v1.1 so closing now (note that v1.1 should ship by the end of the month and RStudio Cloud can update to it independent of RStudio)