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

`read_redcap()` fails with status code 500 and no error message from redcap server #193

Closed RoselyneV closed 5 months ago

RoselyneV commented 5 months ago

My code

this is my code: library(devtools) devtools::install_github("CHOP-CGTInformatics/REDCapTidieR")

my_token <- "xxxxxxxxxx" url <- "https://xxxxxxxx"

data_suppertbl <- REDCapTidieR::read_redcap(url, my_token)

Log from R studio

_Error in REDCapTidieR::read_redcap(): ✖ The REDCapR export operation was not successful. ! An unexpected error occured. ℹ This means that you probably discovered a bug! ℹ Please consider submitting a bug report here: https://github.com/CHOP-CGTInformatics/REDCapTidieR/issues. Caused by error in redcap_read_oneshot(): ! The REDCapR read/export operation was not successful. The error message was: Run rlang::last_trace() to see where the error occurred._

My code

rlang::last_trace()

Log from R studio

Error in REDCapTidieR::read_redcap(): ✖ The REDCapR export operation was not successful. ! An unexpected error occured. ℹ This means that you probably discovered a bug! ℹ Please consider submitting a bug report here: https://github.com/CHOP-CGTInformatics/REDCapTidieR/issues. Caused by error in redcap_read_oneshot(): ! The REDCapR read/export operation was not successful. The error message was:

Backtrace: ▆

  1. └─REDCapTidieR::read_redcap(url, my_token)
  2. └─REDCapTidieR:::tryredcapr(...)

Question

Could the problem be due to the size of the database?

ezraporter commented 5 months ago

Thanks for the bug report! It looks like the error message from redcap_read_oneshot() got cut off. Can you try calling redcap_read_oneshot() directly and let me know the result? Should be:

REDCapR::redcap_read_oneshot(url, my_token)
RoselyneV commented 5 months ago

The result is:

The REDCapR read/export operation was not successful. The error message was:

$data tableau de données (data frame) avec 0 colonnes et 0 ligne

$success [1] FALSE

$status_code [1] 500

$outcome_message [1] "The REDCapR read/export operation was not successful. The error message was:\n"

$records_collapsed [1] ""

$fields_collapsed [1] ""

$forms_collapsed [1] ""

$events_collapsed [1] ""

$filter_logic [1] ""

$datetime_range_begin [1] ""

$datetime_range_end [1] ""

$elapsed_seconds [1] 4.461725

$raw_text [1] ""

ezraporter commented 5 months ago

Thanks! Unfortunately not much information in there to go off of. It seems that you're having trouble getting data from your redcap server prior to REDCapTidieR doing any real processing. You'll need to solve that issue before we can really know if changes to REDCapTidieR will help you. Here are some debugging ideas:

  1. Try REDCapR::redcap_read(url, my_token) to see if batch downloading yields any results. If the issue is the size of the data this would tell you.
  2. Try playing with the options in redcap_read_oneshot() to see if any configuration gets you data. Sometimes this reveals issues with your redcap structure or user rights that you may need to resolve.

I'm going to close this issue for now but please feel free to reopen if, for example, you find that there are additional parameters to redcap_read_oneshot() that we can expose to solve your download issue. Additionally, if you find that redcap_read() helps, let us know on the open issue we have for supporting that (#103). We'd probably give it some extra priority if we had someone who needed it 😄

RoselyneV commented 5 months ago

Thanks for your help

skadauke commented 5 months ago

@RoselyneV can you double check your URI? You might get a 500 error if you provide the wrong URI.