daroczig / fbRads

Analyze and manage Facebook ads from R using this client library to access their Marketing APIs
GNU Affero General Public License v3.0
153 stars 57 forks source link

Error in Fbad_request #54

Closed bofrmar closed 7 years ago

bofrmar commented 7 years ago

Hello,

I run a R studio script on a daily basis and as of yesterday I encountered an error while running the script. This is what I get:

Error in fbadrequest(path = paste0("act", accountid, "/"), method = "GET", : This is a bug in the fbRads package. Please report on GitHub with a detailed output: SSL certificate problem: self signed certificate in certificate chain

Any ideas of what the issue might be?

Thanks in advance

daroczig commented 7 years ago

Sometimes there's a temporary connection or SSL issue, which should be resolved in a few mins at Facebook's end. Can you please confirm it's an ongoing issue or was resolved since then?

bofrmar commented 7 years ago

This is an ongoing issues since yesterday.

daroczig commented 7 years ago

Are you using v2.8 or still on v2.7? Can you share the command generating this error message and a full traceback?

bofrmar commented 7 years ago

I am not very technical or an expert in R scripts, but this is what I could find:

fbad_init(accountid = account_id, token = fbtkn, version = '2.8')
startdate <- Sys.Date() - if(as.POSIXlt(Sys.Date())$wday == 1) {
  3
}  else {
  1
}
enddate <- Sys.Date() - 1
daroczig commented 7 years ago

Can you please share your session info? Just run sessionInfo() or if you have devtools installed, then devtools::session_info()

bofrmar commented 7 years ago

Sorry, here you go:

sessionInfo() R version 3.3.3 (2017-03-06) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] tidyr_0.6.1 dplyr_0.5.0 rjson_0.2.15 rlist_0.4.6.1 jsonlite_1.3 fbRads_0.2

loaded via a namespace (and not attached): [1] Rcpp_0.12.10 assertthat_0.1 digest_0.6.12 bitops_1.0-6 R6_2.2.0
[6] plyr_1.8.4 futile.options_1.0.0 DBI_0.6 magrittr_1.5 data.table_1.10.4
[11] futile.logger_1.4.3 lambda.r_1.1.9 tools_3.3.3 bit64_0.9-5 RCurl_1.95-4.8
[16] bit_1.1-12 tibble_1.2

daroczig commented 7 years ago

Can you try updating cacert.pem to the most recent one found at https://curl.haxx.se/ca/cacert.pem ?

To find the currently installed cacert.pem on your computer, run this in R:

system.file('CurlSSL', 'cacert.pem', package = 'RCurl')

Then once you know the file path, download the above file from curl.haxx.se, overwrite the old one and retry the script. I think this issue is related to the outdated cacert.pem

bofrmar commented 7 years ago

This didn't work, I also tried installing RCurl again but no success. Any other ideas?

fbad_init(accountid = account_id, token = fbtkn, version = '2.8') ERROR [2017-04-20 17:03:40] URL: ????? ERROR [2017-04-20 17:03:40] Method: GET ERROR [2017-04-20 17:03:40] Params: List of 1 $ fields: chr "name,account_id,account_status,age,amount_spent,balance,capabilities,end_advertiser,funding_source,spend_cap,timezone_id,users" Error in fbadrequest(path = paste0("act", accountid, "/"), method = "GET", : This is a bug in the fbRads package. Please report on GitHub with a detailed output: SSL certificate problem: self signed certificate in certificate chain

daroczig commented 7 years ago

That's odd. Any chance you are behind a firewall/proxy that adds a man in the middle cert?

bofrmar commented 7 years ago

Actually this might be. Its interesting because it was working fine, something might have changed in the firewall/proxy.

daroczig commented 7 years ago

Can you please confirm with the IT folks? Please let me know what you find, and I'll try to reproduce this locally if that's not the case.

bofrmar commented 7 years ago

IT is looking into the issue. Seems like there was a changed in the firewall. Will keep you updated.

I am seeing a similar issue in the curl package. Do you think this might be the firewall change as well?

Error in curl::curl_fetch_memory(url, handle = handle) : Problem with the SSL CA cert (path? access rights?)

daroczig commented 7 years ago

Do you have any update from the IT team?

bofrmar commented 7 years ago

Yes, the issue with the fbRads package was related to a change in our firewall. Thanks for the help

daroczig commented 7 years ago

Cool, thanks a lot for the feedback.