From c800a45115fd7c889a9dd3c6c25185453a7ab21b Mon Sep 17 00:00:00 2001 From: ChaitaC Date: Mon, 9 Mar 2026 14:23:10 -0500 Subject: [PATCH 1/2] fix: Disable httr2 for shinyapps.io bundle uploads The shinyapps.io API returns a 303 redirect during updateBundleStatus, and httr2 drops the request body on redirect while keeping the X-Content-Checksum header, causing a "bad checksum" HTTP 400 error. Work around this by using the legacy libcurl backend for the entire shinyapps bundle upload flow. Fixes #1297 Co-Authored-By: Claude Opus 4.6 --- R/client.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R/client.R b/R/client.R index 1cf9083a..6aa4de56 100644 --- a/R/client.R +++ b/R/client.R @@ -145,6 +145,13 @@ uploadShinyappsBundle <- function( bundlePath, verbose = FALSE ) { + # Disable httr2 for shinyapps.io bundle uploads. The shinyapps.io API + # returns a 303 redirect during updateBundleStatus, and httr2 drops the + # request body on redirect while keeping the X-Content-Checksum header, + # causing a "bad checksum" error. + # See https://github.com/rstudio/rsconnect/issues/1297 + old <- options(rsconnect.httr2 = FALSE) + on.exit(options(old)) # Step 1. Create presigned URL and register pending bundle. bundleSize <- file.info(bundlePath)$size bundle <- client$createBundle( From 51c8cc4d8d4b44237745ef8411313c480419bad9 Mon Sep 17 00:00:00 2001 From: ChaitaC Date: Mon, 9 Mar 2026 17:38:42 -0500 Subject: [PATCH 2/2] fix: Disable httr2 for all shinyapps.io API calls Move the httr2 workaround from uploadShinyappsBundle to clientForAccount. The uploadShinyappsBundle-only fix was insufficient because on.exit() restored rsconnect.httr2 = TRUE before deployApplication ran. deployApplication also gets a 303 redirect (to /v1/tasks/{id}), causing a 405 "Method Not Allowed" error. Disabling httr2 in clientForAccount covers the entire shinyapps.io deployment flow: bundle upload, deploy, task polling, and terminate. Fixes #1297 Co-Authored-By: Claude Opus 4.6 --- R/client.R | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/R/client.R b/R/client.R index 6aa4de56..880ae576 100644 --- a/R/client.R +++ b/R/client.R @@ -4,6 +4,13 @@ clientForAccount <- function(account) { serverUrl <- parseHttpUrl(serverInfo$url) if (isShinyappsServer(account$server)) { + # Disable httr2 for shinyapps.io. The shinyapps.io API returns 303 + # redirects on several POST endpoints (updateBundleStatus, + # deployApplication), and httr2 drops the request body on redirect + # while keeping the X-Content-Checksum header, causing "bad checksum" + # and "Method Not Allowed" errors. + # See https://github.com/rstudio/rsconnect/issues/1297 + options(rsconnect.httr2 = FALSE) shinyAppsClient(serverUrl, account) } else if (isPositConnectCloudServer(account$server)) { connectCloudClient(serverUrl, account) @@ -145,13 +152,6 @@ uploadShinyappsBundle <- function( bundlePath, verbose = FALSE ) { - # Disable httr2 for shinyapps.io bundle uploads. The shinyapps.io API - # returns a 303 redirect during updateBundleStatus, and httr2 drops the - # request body on redirect while keeping the X-Content-Checksum header, - # causing a "bad checksum" error. - # See https://github.com/rstudio/rsconnect/issues/1297 - old <- options(rsconnect.httr2 = FALSE) - on.exit(options(old)) # Step 1. Create presigned URL and register pending bundle. bundleSize <- file.info(bundlePath)$size bundle <- client$createBundle(