MotherDuck on Posit Cloud

Hello - wonder if anyone has successfully configured a Shiny data source using MotherDuck (DuckDB) on Connect Cloud?

I'm trying to set up a small demo Shiny App on Connect Cloud that uses MotherDuck (DuckDB cloud compute engine) as the data source. Of course, it "Works fine on my local machine", however, the publishing to Connect Cloud fails at this point:

2025-10-16T18:41:25-07:00   Invalid Error: IO Error: Extension "/home/connect/.local/share/R/duckdb/extensions/v1.4.0/linux_amd64/motherduck.duckdb_extension" not found.
2025-10-16T18:41:25-07:00 Extension "motherduck" is an existing extension.
2025-10-16T18:41:25-07:00 
2025-10-16T18:41:25-07:00 Install it first using "INSTALL motherduck".

In the connection function, I've included the INSTALL statement as prompted in the error message using this function:

md_connect <- function(config_env = 'default') {
    
    config <- config::get(config = config_env)
    
    conn <- DBI::dbConnect(duckdb::duckdb(), ":memory:")
    
    # Authenticate with MotherDuck Token 
    DBI::dbExecute(conn, "INSTALL motherduck")  # <--- this doesn't work as expected 
    DBI::dbExecute(conn, "LOAD motherduck")
    
    if (config$md_token != "") { 
        auth_query <- paste0("SET motherduck_token='", config$md_token, "';")
        dbExecute(conn, auth_query)
        }
    
    # Attach to MotherDuck 
    DBI::dbExecute(conn, "ATTACH 'md:'")
   
    # return the connection object
    conn 
    
}

Thanks for any suggestions.

1 Like

Hello - I've also had trouble getting this to work with R and shifted to Shiny for Python where it worked out of the box. For example, aquarium-search/persistence/motherduck at main · alex-chisholm/aquarium-search · GitHub

Can you please let us know the content id associated with your failed deployment? You can find it from the content admin page. It is the long uuid in the url: connect.posit.cloud/[account-name]/content/[content-id]

Thanks,

Alex

Thanks for looking into this.

The content-id is:
0199f85a-e66c-52f1-79e8-92a917ee5bfd

Thanks. My colleague Sam made a sample app that works for us pretty well. Perhaps the code in app.R here can help you: GitHub - alex-chisholm/motherduck-r

We also deployed it for live token testing: https://alex-chisholm-motherduck-r.share.connect.posit.cloud/

Thanks - I was able to get it to work as expected after focusing on:

  • renv was correct
  • config.yml was included in the bundle
  • token was configured correctly.

Working as expected now but still can't say that I know exactly what fixed it.

Thanks for your help and the working examples. Both were helpful!

1 Like