iobis / robis

R client for the OBIS API
https://iobis.github.io/robis
Other
37 stars 11 forks source link

Http requests to API seem to be down, returning a variety of errors #64

Closed annakrystalli closed 4 years ago

annakrystalli commented 4 years ago

Hello,

I have been working on some functionality that wraps robis this week. The package seemed to be working fine. However, from this morning, all requests seem to be returning errors, and the error messages seem to vary. Eg

dataset()

robis::dataset(scientificname = "mola mola")
#> Error in robis::dataset(scientificname = "mola mola"): Bad Request (HTTP 400).

Created on 2020-03-25 by the reprex package (v0.3.0)

checklist()

robis::checklist("Mola mola")
#> Error in robis::checklist("Mola mola"): Bad Request (HTTP 400).

Created on 2020-03-25 by the reprex package (v0.3.0)

occurrence()

fields = c(
    "decimalLongitude", "decimalLatitude",
    "minimumDepthInMeters", "maximumDepthInMeters", "depth",
    "eventDate", "year", "month",
    "scientificName", "aphiaID"
)
robis::occurrence(
    taxonid = 325567 , fields = fields
)
#> Error in robis::occurrence(taxonid = 325567, fields = fields): Internal Server Error (HTTP 500).

Created on 2020-03-25 by the reprex package (v0.3.0)

Digging into the occurrence function, here's the request result


# set arguments
scientificname = NULL 
taxonid = 325567 
datasetid = NULL 
nodeid = NULL 
areaid = NULL 
startdate = NULL 
enddate = NULL 
startdepth = NULL 
enddepth = NULL 
geometry = NULL 
redlist = NULL 
exclude = NULL 
fields = NULL 
verbose = FALSE

after <- "-1"
result_list <- list()
last_page <- FALSE
i <- 1
fetched <- 0

# create query
query <- list(scientificname = robis:::handle_vector(scientificname), 
              taxonid = robis:::handle_vector(taxonid), datasetid = robis:::handle_vector(datasetid), 
              nodeid = robis:::handle_vector(nodeid), areaid = robis:::handle_vector(areaid), 
              startdate = robis:::handle_date(startdate), enddate = robis:::handle_date(enddate), 
              startdepth = startdepth, enddepth = enddepth, geometry = geometry, 
              redlist = robis:::handle_logical(redlist), exclude = robis:::handle_vector(exclude), 
              fields = robis:::handle_fields(fields), after = after, size = robis:::page_size())

# make get occurence request
result <- robis:::http_request("GET", "occurrence", query)
result
#> Response [https://api.obis.org/v3/occurrence?taxonid=325567&after=-1&size=5000]
#>   Date: 2020-03-25 08:54
#>   Status: 500
#>   Content-Type: text/html; charset=utf-8
#>   Size: 180 B

Created on 2020-03-25 by the reprex package (v0.3.0)

A taxon get request to the API using https://api.obis.org/v3/taxon/325567 returns a successful result:

{"total":1,"results":[{"scientificName":"Scytothamnus fasciculatus","scientificNameAuthorship":"(J.D.Hooker & Harvey) A.D.Cotton, 1915","taxonID":325567,"taxonRank":"Species","taxonomicStatus":"accepted","acceptedNameUsage":"Scytothamnus fasciculatus","acceptedNameUsageID":325567,"is_marine":true,"kingdom":"Chromista","subkingdom":"Harosa","infrakingdom":"Heterokonta","phylum":"Ochrophyta","subphylum":"Phaeista","infraphylum":"Limnista","superclass":"Fucistia","class":"Phaeophyceae","order":"Scytothamnales","family":"Splachnidiaceae","genus":"Scytothamnus","species":"Scytothamnus fasciculatus","kingdomid":7,"subkingdomid":582419,"infrakingdomid":368898,"phylumid":345465,"subphylumid":588641,"infraphylumid":591205,"superclassid":588642,"classid":830,"orderid":368703,"familyid":196190,"genusid":325566,"speciesid":325567}]}

But https://api.obis.org/v3/occurrence?taxonid=325567 and https://api.obis.org/v3/occurrence?taxonid=325567&after=-1&size=5000] (the underlying request) returns:

Something broke: [index_not_found_exception] no such index [occurrence], with { resource.type="index_or_alias" & resource.id="occurrence" & index_uuid="_na_" & index="occurrence" }

Not sure what the issue is and it's hard to find information on why the workflow is not working. The CI system in the robis repository doesn't seem to have detected it either (last build of master appears to be 3 months ago). Perhaps setting TRAVIS on a daily CRON job would pick something like this up which would at least give some indication to users that the service is down and through TRAVIS logs, perhaps some insight also.

pieterprovoost commented 4 years ago

Thanks for reporting, we are experiencing technical difficulties with the OBIS backend and are working hard to get everything back online.

annakrystalli commented 4 years ago

No worries at all, I appreciate the fast response.