How to set up`CHROMOTE_CHROME` environment variable to the executable of a Chromium-based browser in Posit Connect Cloud

Dear
The following pdf downloader for the GT table based on gtsave() i does not work in the shiny app deployed at posit connect cloud:

# Download handler for GO gene list table
    output$download_go_gene_list <- downloadHandler(
      filename = function() {
        paste0("GO_Gene_List_Table_", format(Sys.time(), "%Y%m%d_%H%M"), ".pdf")
      },
      content = function(file) {
        req(input$color_highlight, enrichment_results_list)
        colors_to_use <- if(input$color_highlight) {
          req(input$up_color, input$down_color)
          c(input$down_color, input$up_color)
        } else {
          c("#000000", "#000000")  # default black if highlighting is disabled
        }
        gt_table <- build_gt_gene_lists(
          df = uploaded_df(),  
          annotation_col = input$annotation_col,
          chosen_go = input$go_category,
          go_data = GO,
          alpha = input$alpha,
          fold_col = input$fold_col,
          color_highlight = colors_to_use,
          log_messages_rv = log_messages,
          log_event = log_event
        )
        gtsave(gt_table, file)
      }
    )

The log system at the server informs that it needs chrome like browser and that I should set the CHROMOTE_CHROME environment variable to the path of a Chromium/Chrome executable:

2025-01-10T15:35:28+01:00 `google-chrome`, `chromium-browser` and `chrome` were not found. Try setting the `CHROMOTE_CHROME` environment variable to the executable of a Chromium-based browser, such as Google Chrome, Chromium or Brave or adding one of these executables to your PATH.
2025-01-10T15:35:28+01:00 Warning: Error in initialize: Invalid path to Chrome
2025-01-10T15:35:28+01:00   15: <Anonymous>
2025-01-10T15:35:28+01:00   13: fn
2025-01-10T15:35:28+01:00    8: retry
2025-01-10T15:35:28+01:00    7: connect$retryingStartServer
2025-01-10T15:35:28+01:00    6: eval
2025-01-10T15:35:28+01:00    5: eval
2025-01-10T15:35:28+01:00    4: eval
2025-01-10T15:35:28+01:00    3: eval
2025-01-10T15:35:28+01:00    2: eval.parent
2025-01-10T15:35:28+01:00    1: local 

How to locate this path - is chrome installed in the cloud system? How I can set this variable to the cloud enrironment? Everything else in a big app including other pdf file downloaders using ggsave() and not gtsave() are working correctly... all the help appreciated :slightly_smiling_face:

Hello. Thanks for bringing this to our attention.

We've added an issue to investigate how to support this workflow on Connect Cloud. I'll update here when we have more information.

I had the same problem. It appears chrome related.
Read the chromate md in the package and found
The headless mode used by Chrome can now be selected with the chromote.headless option or CHROMOTE_HEADLESS environment variable.

In Chrome v128, a new headless mode became the default. The new mode uses the same browser engine as the regular Chrome browser, whereas the old headless mode is built on a separate architecture. The old headless mode may be faster to launch and is still well-suited to many of the tasks for which chromote is used.

For now, to avoid disruption, chromote defaults to using the old headless mode. In the future, chromote will follow Chrome and default to "new" headless mode. (And at some point, Chrome intends to remove the old headless mode which is now offered as a separate binary.) To test the new headless mode, use options(chromote.headless = "new") or CHROMOTE_HEADLESS="new" (in .Renviron or via Sys.setenv()). (#172)

I put options(chromote.headless = "new") in the markdown and gtsave worked.
Hope this works for you.

2 Likes

I put options(chromote.headless = "new") in the markdown and gtsave worked.
Hope this works for you.

Thanks - can I set this somehow in the posit connect cloud environment by myself?

Hi
Chromote 0.4.0 is out and no longer defaults to old chrome.
Try updating the chromote package in r to 0.4.0 and it may fix it.

I am curious to know if this issue related to Chrome is resolved. I am using 0.4.0 chromote and have tried to Chromote$new with CHROMOTE_HEADLESS="new without much success on shinyio. It works perfectly fine locally. This is need for two functionalities I use, mapshot2 and webshot2::webshot.

Note, I ran this exact code in shinyapps.io, and it worked, and immediately my account got suspended till end of my life 'account is suspended (Use of paid process)' for using a paid feature. How to properly configure Google Chrome on Shinyapps.io (because of webshot2) - #5 by rlesur Since, I cant post any message on that closed thread, I thought of notifying folks.

Hi Alex, anything new about the Chrome issue in Posit Connect Cloud?

Hi @paintedstork , I also tested the solution you mentioned and my account got suspended. Have you managed to have it reactivated?

Thanks for following up. We've added the issue back to the board to discuss next week after deferring it for the last few months.

When it is supported, it will only be available on paid plans so that we can limit its security risk. This will be similar to how we allow it on Posit Cloud and shinyapps.io.

Hello - which platform did you test this on? Although Chrome shouldn't work yet on Connect Cloud, the behavior you describe is expected for Posit Cloud and shinyapps.io, where only paid plans can use that process.

Thank you very much for the quick response. Perfect. I'll be waiting to see when it's available.

Hi all. Everyone should now be able to do this on Connect Cloud. Eventually, it will only be allowed on paid plans, similar to how it works on Posit Cloud and shinyapps.io.

Working fine now! Thank you so much

1 Like