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

Pin unable to overwrite old pin - Error 403 #539

Closed
dewoller opened this issue Oct 17, 2021 · 6 comments
Closed

Pin unable to overwrite old pin - Error 403 #539

dewoller opened this issue Oct 17, 2021 · 6 comments

Comments

@dewoller
Copy link

dewoller commented Oct 17, 2021

Hi All. Love your work! Pins make so many things better. And I would love to use qs as my pin storage format, hence testing out the bleeding edge version of the code. Unfortunately, it doesn't work. The board connects and authenticates, and I can even write a pin. Once. The second time, it errors out.

> rsconnect_board =  board_rsconnect( auth="envvar" )
> rsconnect_board %>% pin_write(iris)
Using `name = 'iris'`
Guessing `type = 'rds'`
Writing to pin 'dennis.wollersheim@XXXX/iris'
> rsconnect_board %>% pin_write(iris)
Using `name = 'iris'`
Guessing `type = 'rds'`
Error in rsc_check_status(req) : Forbidden (HTTP 403).

If I delete the pin first, then I can write, albeit with a warning:

name='iris'
if (pin_exists( rsconnect_board, name)) {
  pin_delete(rsconnect_board, name)
}
pin_write(rsconnect_board, iris, name=name)

#Second run
if (pin_exists( rsconnect_board, name)) {
  pin_delete(rsconnect_board, name)
}
pin_write(rsconnect_board, iris, name=name)


The second run of the code returns the following warning from the pin_delete:

! Please use full name when reading a pin: "dennis.wollersheim@XXXX/iris", not "iris".
! Please use full name when reading a pin: "dennis.wollersheim@XXXX/iris", not "iris".
! Please use full name when reading a pin: "dennis.wollersheim@XXXX/iris", not "iris".

If I include my full name in the name parameter (which I want), e.g.
pin_delete( rsconnect_board, "dennis.wollersheim@XXXX/iris")
I get the following error at the pin_delete call

Error: RStudio Connect API failed [404]

@dewoller
Copy link
Author

dewoller commented Nov 3, 2021

The second write fails when it attempts a http PATCH operation, while the first succeeds using a standard POST.

@sellorm
Copy link
Contributor

sellorm commented Nov 3, 2021

In the environment I have access to (Connect v2021.09.0) this works fine for me.

I'm using pins 1.0.0 with R 4.1.0

I've declared a specific name because there are already "multiple pins with name 'iris'", so I chose something else, but otherwise this is the same as the code you provided.

library(pins)
rsconnect_board =  board_rsconnect( auth="envvar" )
#> Connecting to RSC 2021.09.0 at <https://connect.example.com/rsc>
rsconnect_board %>% pin_write(iris, name = "pins_issue")
#> Guessing `type = 'rds'`
#> Writing to pin 'mark.sellors/pins_issue'
rsconnect_board %>% pin_write(iris, name = "pins_issue")
#> Guessing `type = 'rds'`
#> Writing to pin 'mark.sellors/pins_issue'

Created on 2021-11-03 by the reprex package (v2.0.1)

Similarly, the pin_delete() worked in my case.

It would be worth looking at your Connect instance to ensure that it's up-to-date and that there's nothing in the connect infrastructure environment that might be causing issues. Reverse proxies and things like that for instance.

@dewoller
Copy link
Author

dewoller commented Nov 5, 2021

Thanks @sellorm, your comment about proxies was the clue I needed to solve the issue.

The problem was due to a setting in the Azure gateway web application firewall that exists in front of the Rstudio-rsconnect server. The setting that blocked the PATCH request was REQUEST-911-METHOD-ENFORCEMENT, specifically RuleId 911100, Method is not allowed by policy. This rule blocks all PUT and PATCH requests, and disabling this rule allows pin updating. Woowee!

@sellorm
Copy link
Contributor

sellorm commented Nov 5, 2021

Glad you figured it out! 🎉

@hadley
Copy link
Member

hadley commented Nov 5, 2021

I'm going to close this issue, but it'll still be accessible via search so any one else suffering the same problem is likely to find it.

@github-actions
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants