CHOP-CGTInformatics / REDCapTidieR

Makes it easy to read REDCap Projects into R
https://chop-cgtinformatics.github.io/REDCapTidieR/
Other
33 stars 8 forks source link

[BUG] read_redcap failing after redcap upgrade #191

Closed johnryan412 closed 6 months ago

johnryan412 commented 6 months ago

Expected Behavior

Import my redcap dataset from our institution's URL using the API token.

Over the weekend our institution pushed a redcap system migration and now I can't load the data using read_redcap.

"System migration has been completed. Please contact hs.appsupport@pitt.edu with any issues, being as detailed as possible to allow quick investigation.

The URL has changed, there is a redirect in place from the old URL (ctsiredcap.pitt.edu) to the new one (redcap-std.hs.pitt.edu). This will allow existing survey invitations and links to function as normal. All new invitations sent will go through the new URL."

Current Behavior


> tidy_data<-read_redcap(redcap_url, token)
Error in `read_redcap()`:
✖ The REDCapR export operation was not successful.
! An unexpected error occured.
ℹ This means that you probably discovered a bug!
Caused by error in `curl::curl_fetch_memory()`:
! Maximum (10) redirects followed
Backtrace:
  1. REDCapTidieR::read_redcap(redcap_uri, token)
 10. REDCapR::redcap_metadata_read(...)
 11. REDCapR:::kernel_api(redcap_uri, post_body, config_options)
 12. httr::POST(...)
 13. httr:::request_perform(req, hu$handle$handle)
 15. httr:::request_fetch.write_memory(req$output, req$url, handle)
 16. curl::curl_fetch_memory(url, handle = handle)

How to Reproduce the Bug:

redcap_uri<-"https://ctsiredcap.pitt.edu" token <- Sys.getenv("api") tidy_data<-read_redcap(redcap_uri, token)

(I have verified that the token is still correct, and have tried the new URL)

Screenshots If applicable, add screenshots to help explain your problem.

Failure Logs

If applicable, submit any failure logs or error messages here.

Checklist

Before submitting this issue, please check and verify below that the submission meets the below criteria:

ezraporter commented 6 months ago

Thanks for the bug report! Unfortunately this looks to be a low-level issue with how R is interacting with your institution's REDCap server so it won't be something REDCapTidieR can fix.

You can try filing a bug report with REDCapR, the library we depend on to interact with REDCap: https://github.com/OuhscBbmc/REDCapR/issues. Your best bet may be to work with your institution's REDCap admins to resolve the excessive redirects issue in the error message you posted.

I'm going to close this issue for now but feel free to re-open if, for example, there's some option REDCapTidieR can expose that will let you get around the redirect error.

ezraporter commented 6 months ago

Should also note it looks like you may be using the old url in your code example? Switching to the new url may resolve.

johnryan412 commented 6 months ago

Yeah, unfortunately no luck with either. I've reached out to our IT team. Will provide an update if we find a resolution.

On Mon, Apr 15, 2024 at 7:12 PM Ezra Porter @.***> wrote:

Should also note it looks like you may be using the old url in your code example? Switching to the new url may resolve.

— Reply to this email directly, view it on GitHub https://github.com/CHOP-CGTInformatics/REDCapTidieR/issues/191#issuecomment-2057963353, or unsubscribe https://github.com/notifications/unsubscribe-auth/BANB444EXTAUH3HFXZUMBNDY5RNHLAVCNFSM6AAAAABGH666HKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJXHE3DGMZVGM . You are receiving this because you authored the thread.Message ID: @.***>

johnryan412 commented 6 months ago

It was an issue with the link - There is now a special link for API access. Thanks for your help!

FYI - anyone from Pitt, it's https://redcap-std.hs.pitt.edu/redcap/api/