geosapi + shiny-server

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. I am concerned that shiny-sever doesn't allow REST APIs or I am doing something very wrong. I'm not too sure so if anyone is able to help out that would be amazing!

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