eblondel / geosapi

R interface to GeoServer REST API
https://github.com/eblondel/geosapi/wiki
Other
34 stars 5 forks source link

geosapi + shiny-server #58

Closed KoniWatsonVekta closed 7 months ago

KoniWatsonVekta commented 1 year ago

I am currently trying to set up a leaflet mapping tool using shiny and Posit open source shiny-server.

There is a list of map layers that are hosted on geoserver and are accessed via the geosapi R package. Locally I am able to create the connection to the geoserver using the geosapi function:

GSManager$new()

This 99% of the time works, the only time it doesn't is if I have lost internet connection or if our geoserver has gone down for some reason. This normally produces the following error:

image

The error occurs because the follow tryCatch hits an issue so it sets gsman to NULL:

gsman <- tryCatch({
  GSManager$new(
    url = baseUrl,
    #baseUrl of the Geoserver
    user = user,
    pwd = pwd,
    #credentials
    logger = NULL #logger, for info or debugging purpose
  )
},
error = function(cond) {
  print(paste0("here ", cond))
  return(NULL)
})

For some unknown reason I get this same error when attempting to deploy my shiny application to my shiny-server but not when hosting it on Posit Connect. Is there another reason why GSManager$new() might be failing?

Server -> Ubuntu 21.10 R -> 4.1.2 Shiny -> 1.7.3 geosapi -> 0.6.4 Shiny-Server -> 1.5.17.973 Node.js -> 12.22.6

eblondel commented 11 months ago

@KoniWatsonVekta apologies i had not seen this issue. I will look at it asap.

KoniWatsonVekta commented 11 months ago

That's no worries! Thanks for looking into it! For ourselves and our workflow we have moved away from our original set up which the issues was found but could be useful encase someone else has the same issue.

eblondel commented 11 months ago

They are many reasons why it might fail, networking issues, etc depending on the server characteristics. A good way to see what happens behind the scene, is to set the logger parameter to "DEBUG". This will make the HTTP calls verbose, and can give us a diagnosis