Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting an application in shinyapps.io causes a 404 when re-deploying #226

Closed
jspiewak opened this issue Nov 27, 2017 · 3 comments · Fixed by #770
Closed

Deleting an application in shinyapps.io causes a 404 when re-deploying #226

jspiewak opened this issue Nov 27, 2017 · 3 comments · Fixed by #770
Labels
bug an unexpected problem or unintended behavior shinyapps.io 🎖️

Comments

@jspiewak
Copy link
Member

Once an application has been deployed, the dcf files stores the application id which is used for subsequent interactions. If the application is deleted via browser interaction, further rsconnect calls result in a 404 error because the application is no longer server side. The current work around is to manually delete the dcf file, usually after having had to ask for help in a forum.

Consider handling 404 errors explicitly with a more informative message or actually removing the dcf file itself.

@jmcphers
Copy link
Member

@adamconroy This might be an easy addition to metadata sync (i.e. whatever code you write which detects deleted apps and deletes their local records could be invoked prior to publish, too)

@jmcphers
Copy link
Member

See also feedback in #331.

@hadley hadley added bug an unexpected problem or unintended behavior shinyapps.io 🎖️ labels Feb 21, 2023
@hadley
Copy link
Member

hadley commented Mar 13, 2023

Note to self:

# look in stash for other changes

getApplicationForDeployment <- function(client, target) {
  tryCatch(
    client$getApplication(target$appId),
    rsconnect_http_404 = function(err) {
      applicationDeleted(client, target)
    }
  )
}

applicationDeleted = function(client, target, recordPath)
  header <- "Failed to find existing application on server; it's probably been deleted."
  not_interactive <- "Use {.fn forgetDeployment} to remove outdated record and try again."
  prompt <- "What do you want to do?"
  choices <- c(
    "Give up and try again later",
    "Delete existing deployment & create a new app"
  )

  cli_menu(header, prompt, choices, not_interactive = not_interactive, quit = 1)
  # Must be option 2
  
  path <- deploymentConfigFile(recordPath, target$appName, target$account, target$server)
  unlink(path)

  accountDetails <- accountInfo(target$account, target$server)
  client$createApplication(
    target$appName,
    target$appTitle,
    "shiny",
    accountDetails$accountId
  )
}

hadley added a commit that referenced this issue Mar 14, 2023
If `deployApp()` determines that it's publishing to an app that doesn't exist, it offers the user the choice to create a new app. Fixes #226.

Includes somewhat of a revamp to `syncAppMetadata()` to delete deployments that don't correspond to known applications. Interactive testing of this function revealed some other problems that I fixed, along with generally tidying up the code.
hadley added a commit that referenced this issue Mar 16, 2023
If `deployApp()` determines that it's publishing to an app that doesn't exist, it offers the user the choice to create a new app. Fixes #226.

Includes somewhat of a revamp to `syncAppMetadata()` to delete deployments that don't correspond to known applications. Interactive testing of this function revealed some other problems that I fixed, along with generally tidying up the code.

New `addTestDeployment()` and `simulate_user_input()` to make testing easier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior shinyapps.io 🎖️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants