rstudio / pins-r

Pin, discover, and share resources
https://pins.rstudio.com
Other
312 stars 63 forks source link

Can't update pins in Rstudio Connect #448

Closed jonnye2 closed 3 years ago

jonnye2 commented 3 years ago

I am using pins version 0.4.5 and when I try to update a pin from an RMarkdown report deployed to RStudio Connect. I can successfully create a pin the first run but when I run the RMarkdown file again to update the pin I get an error:

Error in board_pin_create.rsconnect(board, store_path, name = name, metadata = metadata,

Failed to create pin: Operation failed with status 409: 26Operation failed with status 409: An object with that name already exists.Operation failed with status 409: NULL

It seems this is an ongoing issue #289 , for now I'm having to remove the pin before updating but I would like to be able to access earlier versions of the data so this isn't the best solution.

hadley commented 3 years ago

Could you please try with the development version of pins? You can try with either the new or old API (see https://github.com/rstudio/pins)

jonnye2 commented 3 years ago

Using the development version, I tried the new and old api and I'm getting an error with both:

Error: RStudio Connect API failed [400] * Cannot open manifest

Seems like I can't connect the board since I'm not seeing existing pins in the connection tab.

hadley commented 3 years ago

Can you please include a reprex, and a traceback() would be useful too.

jonnye2 commented 3 years ago
library(pins)

# old api
board_register_rsconnect(server = my_connect)
pin(mtcars, "test_1", board = "rsconnect")
#> Error: RStudio Connect API failed [400]
#> * Cannot open manifest

# new api
b <- board_rsconnect(server = my_connect)
b %>% pin_write(mtcars, "test22")
#> Guessing `type = 'rds'`
#> Error: RStudio Connect API failed [400]
#> * Cannot open manifest
> traceback()
9: stop(fallback)
8: signal_abort(cnd)
7: abort(c(paste0("RStudio Connect API failed [", req$status_code, 
       "]"), json$error))
6: rsc_check_status(req)
5: rsc_POST(board, rsc_v1("content", content_guid, "deploy"), body = list(bundle_id = bundle_id), 
       )
4: pin_store.pins_board_rsconnect(board, name, path, meta, versioned = versioned, 
       x = x, ...)
3: pin_store(board, name, path, meta, versioned = versioned, x = x, 
       ...)
2: pin_write(., mtcars, "test22")
1: b %>% pin_write(mtcars, "test22")
hadley commented 3 years ago

Do you have the very latest dev version? I fixed a problem that generated the same error a couple of days ago.

jonnye2 commented 3 years ago

I think so, installed package from github yesterday.

hadley commented 3 years ago

Ok, I'd suggest reinstalling from github just be sure.

If that doesn't help, then I think I'm going to need to get a copy of the bundle that pins is attempting to upload to RSC. There's no particularly easy way to do this, but this series of steps should work:

  1. Run debugonce(pins:::rsc_bundle)
  2. Call `b %>% pin_write(mtcars, "test22")
  3. The debugger should open and you can type bundle_path to get the path where the bundle is saved
  4. Press c to continue running the rest of the code
  5. After it fails, zip up the bundle_path directory and attach it to the issue (this directory doesn't contain any private information)
hadley commented 3 years ago

@jonnye2 and could you please give me the output of sessioninfo::session_info("pins")?

hadley commented 3 years ago

Should be fixed now; was a weird bug in utils::tar().

jonnye2 commented 3 years ago

Works perfectly. Much appreciated!

dcph-tboulay commented 2 years ago

Also recently had this issue. I added:

Sys.setenv(RSCONNECT_TAR="/usr/bin/tar") Sys.setenv(tar="/usr/bin/tar")

And it resolved.

github-actions[bot] commented 2 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.