ropensci / taxize

A taxonomic toolbelt for R
https://docs.ropensci.org/taxize
Other
270 stars 61 forks source link

Error: Bad Gateway (HTTP 502) #863

Closed hmorzaria closed 3 years ago

hmorzaria commented 3 years ago

I keep getting this Bad gateway error. A similar call with db='worms' works fine, so I assume there is some error with the itis API, but wanted to check I am not missing anything. I did notice using verbose=TRUE resolves quickly, otherwise the call hangs for a long time, before returing the bad gateway. I was testing individual calls, not in a function or loop (which does introduce a Sys.sleep)

> itis.synonym <- taxize::synonyms("Poa annua", db='itis')
══  1 queries  ═══════════════

Retrieving data for taxon 'Poa annua'

Error: Bad Gateway (HTTP 502)

> itis.synonym <- taxize::synonyms("Poa annua", db='itis', verbose= TRUE)

Retrieving data for taxon 'Poa annua'

* Found bundle for host www.itis.gov: 0x55584ea04b50 [can pipeline]
* Re-using existing connection! (#4) with host www.itis.gov
* Connected to www.itis.gov (137.227.231.25) port 443 (#4)
> GET /ITISWebService/jsonservice/getITISTermsFromScientificName?srchKey=Poa%20annua HTTP/1.1
Host: www.itis.gov
User-Agent: libcurl/7.58.0 r-curl/4.3 crul/1.0.0
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*

< HTTP/1.1 200 
< Date: Mon, 07 Dec 2020 22:39:21 GMT
< Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
< X-Content-Type-Options: nosniff
< Content-Type: text/json;charset=ISO-8859-1
< Content-Length: 3095
< 
* Connection #4 to host www.itis.gov left intact
✓  Found:  Poa annua
══  Results  ═════════════════

● Total: 1 
● Found: 1 
● Not Found: 0
* Found bundle for host www.itis.gov: 0x55584ea04b50 [can pipeline]
* Re-using existing connection! (#4) with host www.itis.gov
* Connected to www.itis.gov (137.227.231.25) port 443 (#4)
> GET /ITISWebService/jsonservice/getAcceptedNamesFromTSN?tsn=41107 HTTP/1.1
Host: www.itis.gov
User-Agent: libcurl/7.58.0 r-curl/4.3 crul/1.0.0
Accept-Encoding: gzip, deflate
Accept: application/json, text/xml, application/xml, */*

< HTTP/1.1 200 
< Date: Mon, 07 Dec 2020 22:39:21 GMT
< Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
< X-Content-Type-Options: nosniff
< Content-Type: text/json;charset=ISO-8859-1
< Content-Length: 101
< 
* Connection #4 to host www.itis.gov left intact
sckott commented 3 years ago

Thanks for the issue @hmorzaria !

Can you please share your sessionInfo() (or sessioninfo::session_info())

hmorzaria commented 3 years ago

R version 3.6.3 (2020-02-29) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.4 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale: [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8
[6] LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] kernlab_0.9-29 rpart_4.1-15 randomForest_4.6-14 RSNNS_0.4-12 Rcpp_1.0.5 rJava_0.9-13
[7] earth_5.1.2 plotmo_3.5.7 TeachingDemos_2.12 plotrix_3.7-7 Formula_1.2-3 glmnet_4.0-2
[13] Matrix_1.2-18 mgcv_1.8-31 nlme_3.1-144 mda_0.5-2 class_7.3-16 tree_1.0-40
[19] gbm_2.1.5 dismo_1.1-4 virtualspecies_1.5.1 ggmap_3.0.0 rfishbase_3.1.1 sdm_1.0-89
[25] maxnet_0.1.2 spThin_0.2.0 knitr_1.28 fields_10.3 maps_3.3.0 spam_2.5-1
[31] dotCall64_1.0-0 data.table_1.13.2 XMLSchema_0.7-0 doSNOW_1.0.18 snow_0.4-3 iterators_1.0.13
[37] foreach_1.5.1 future_1.16.0 R.utils_2.9.2 R.oo_1.23.0 R.methodsS3_1.8.0 ridigbio_0.3.5
[43] rvest_0.3.5 xml2_1.3.2 XML_3.99-0.3 rgdal_1.4-8 taxize_0.9.99.92 rebird_1.1.0
[49] rbison_1.0.0 httr_1.4.2 rvertnet_0.8.0 stringi_1.5.3 RCurl_1.98-1.2 ecoengine_1.12.0
[55] forcats_0.5.0 stringr_1.4.0 dplyr_1.0.2 purrr_0.3.4 readr_1.3.1 tidyr_1.0.2
[61] tibble_3.0.4 ggplot2_3.3.0 tidyverse_1.3.0 spocc_1.1.0 sperich_1.5-8 readxl_1.3.1
[67] raster_3.3-13 sp_1.4-2 rgbif_3.3.0 dtplyr_1.0.1 taxizesoap_0.1.1.9830 SSOAP_0.91-0
[73] robis_2.3.10 devtools_2.3.2 usethis_1.6.3

loaded via a namespace (and not attached): [1] utf8_1.1.4 tidyselect_1.1.0 RSQLite_2.2.1 htmlwidgets_1.5.1 munsell_0.5.0 codetools_0.2-16
[7] units_0.6-6 withr_2.3.0 colorspace_1.4-1 uuid_0.1-4 rstudioapi_0.11 listenv_0.8.0
[13] conditionz_0.1.0 urltools_1.7.3 RgoogleMaps_1.4.5.3 oai_0.3.0 bit64_0.9-7 rprojroot_1.3-2
[19] ritis_0.9.0 vctrs_0.3.5 generics_0.1.0 xfun_0.13 worrms_0.4.2 R6_2.5.0
[25] bitops_1.0-6 reshape_0.8.8 assertthat_0.2.1 promises_1.1.0 scales_1.1.0 arkdb_0.0.8
[31] rgeos_0.5-2 gtable_0.3.0 globals_0.12.5 processx_3.4.4 bold_1.1.0 rlang_0.4.9
[37] mapedit_0.6.0 splines_3.6.3 rredlist_0.7.0 lazyeval_0.2.2 broom_0.5.6 modelr_0.1.6
[43] crosstalk_1.1.0.1 backports_1.1.6 httpuv_1.5.2 tools_3.6.3 geoaxe_0.1.0 ellipsis_0.3.1
[49] sessioninfo_1.1.1 plyr_1.8.6 classInt_0.4-3 ps_1.3.2 prettyunits_1.1.1 zoo_1.8-8
[55] haven_2.2.0 fs_1.4.1 crul_1.0.0 magrittr_2.0.1 triebeard_0.3.0 reprex_0.3.0
[61] gh_1.1.0 whisker_0.4 pkgload_1.1.0 hms_0.5.3 mime_0.9 xtable_1.8-4
[67] leaflet_2.0.3 jpeg_0.1-8.1 gridExtra_2.3 shape_1.4.4 testthat_2.3.2 compiler_3.6.3
[73] KernSmooth_2.23-16 crayon_1.3.4 htmltools_0.4.0 later_1.0.0 lubridate_1.7.8 DBI_1.1.0
[79] dbplyr_1.4.2 solrium_1.1.4 rappdirs_0.3.1 sf_0.9-6 cli_2.2.0 pkgconfig_2.0.3
[85] callr_3.5.1 digest_0.6.27 httpcode_0.3.0 cellranger_1.1.0 fauxpas_0.5.0 curl_4.3
[91] shiny_1.4.0.2 rjson_0.2.20 lifecycle_0.2.0 jsonlite_1.7.1 mapproj_1.2.7 desc_1.2.0
[97] fansi_0.4.1 pillar_1.4.7 lattice_0.20-41 fastmap_1.0.1 pkgbuild_1.1.0 survival_3.1-11
[103] glue_1.4.2 remotes_2.2.0 png_0.1-7 bit_1.1-15.2 blob_1.2.1 memoise_1.1.0
[109] e1071_1.7-3 ape_5.4-1

sckott commented 3 years ago

ITIS has been having some long-standing issues with their API that we use. They've been trying to resolve them, but apparently not yet. I've emailed them and will let you know.

hmorzaria commented 3 years ago

I used package ritis::synonym_names and that works. I still get the same bad gateway response from taxize::synonyms

sckott commented 3 years ago

Right. ritis::synonym_names is used internally for taxize::synonyms, so if one works the other should as well

Looks like its working again. is it for you?

r2j2ritson commented 3 years ago

I am also using the itis api, but its giving me 'Error: Service Unavailable (HTTP 503)'. Could it be that they have the api down for repair?

sckott commented 3 years ago

@r2j2ritson That error indicates an ITIS problem. This just worked for me:

synonym_names(tsn=526852)
#> # A tibble: 4 x 3
#>   author                      sciName                         tsn
#>   <chr>                       <chr>                           <chr>
#> 1 (Britton) Á. Löve & D. Löve Acer negundo ssp. interius      28752
#> 2 Britton                     Acer interius                   508253
#> 3 (Britton) Rydb.             Negundo interius                517491
#> 4 (Britton) Á. Löve & D. Löve Negundo aceroides ssp. interius 526197

try again and if it still gives an error, let me know

r2j2ritson commented 3 years ago

Thanks @sckott , its working for me now.

sckott commented 3 years ago

great

bienflorencia commented 3 years ago

Just for the record, I'm having the same Error: Bad Gateway (HTTP 502) message while using functions classification() or get_tsn(). I assume the problem is with ITIS's API as well, do you have the same error while using it?

I'm running this function get_plant_taxonomic_info . Unfortunately the gbif or iucn databases won't work for me as the scientific names change a lot between dbs, but I guess it would be better to switch given that this seems to be a recurrent problem.

sckott commented 3 years ago

@bienflorencia it was probably temporary down time for ITIS. can you try it again now?