Posit Connect Shiny App using Gitlab Private Repo

I have a working Shiny App in rstudio, which installs all packages just fine, including a gitlab private repo and a github repo. Locally, this works using renv.

Publishing this to Posit Connect, we had to replace the github public package, but the gitlab private repo is required. I've tried a few things, and been waiting for support to respond, and it just seems that packrat isn't parsing something correctly.

  • The GITLAB_PAT env is set with r/w repo and read registry permissions (works locally), and even claims to recognize this (message below)
  • Have experimented with a few gcfg settings, including R.RestoreUsesGitCredentials = true, and the GitCredential section (even used my personal user/pass, which obviously has enough permissions).
  • I started an R session on the Posit Connect server and was able to install this package with renv and remotes...just not packrat

Error: Failed to download package from GitLab URL: 'https://gitlab.com/api/v4/projects/[user]%2F[path]%2F[repo]/repository/archive?sha=50bd3dd2d551a500512347e3a2b4261234c94d2'
error downloading 'https://gitlab.com/api/v4/projects/...' [curl: (22) The requested URL returned error: 401curl: HTTP 401 https://gitlab.com/api/v4/projects/...
If you are trying to restore a package from a private Git repo, you must have credentials available in your environment, and Packrat must be configured to use an auth-capable download method. GITLAB_PAT found; check that it is correct. Packrat is configured to use internal renv for authenticated downloads.

Unable to fully restore the R packages associated with this deployment.
Please review the preceding messages to determine which package
encountered installation difficulty and the cause of the failure.

Hi, did you find a solution to this?

I can get the app deployed with a private library using R 4.1.1 and packrat 0.7.0. However upgrading to 4.2.1 returns the same error you received.

Thanks