Issue with as.resource.object(rse) Error in curl

Hi, I am trying to use datashield resource and am getting an error in curl.

opal.file_upload(o, "./iris.rds", "/projects/IRIS")

token <- opal.token_r_create(connections, "iris", projects = "IRIS")
opal.resource_create(o, "IRIS", "iris", url = "opal+https://host.mydomain.it/ws/files/projects/IRIS/iris.rds" , format="matrix", secret=token)
opal.resource_perm_add(o, "IRIS", "iris", subject = “administrator”, type = "user", permission = "view")
builder <- newDSLoginBuilder()
builder$append(server = "server1",  url = "https://host.mydomain.it",
               user = "administrator", password = “P@ssw0rd”, 
               driver = "OpalDriver")

logindata <- builder$build()
conns <- datashield.login(logins = logindata, assign = TRUE, symbol = "res")
datashield.resources(conns)
datashield.assign.resource(conns, "rse", "IRIS.iris")
datashield.assign.expr(conns = conns, symbol = "D",
                            expr = as.symbol("as.resource.object(rse)"))

“Command ‘as.resource.object(rse)’ failed on ‘server1’: Error while evaluating ‘is.null(base::assign(‘D’, value={resourcer::as.resource.object(rse)}))’ → Error in curl::curl_fetch_disk(url, x$path, handle = handle) : \n Couldn’t connect to server [host.mydomain.it]: Failed to connect to host.mydomain.it port 443 after 3 ms: Couldn’t connect to server\n”

Hi,

That kind of resource consists of making the R server download a file from an external service (more specifically a Opal server). The error reported says that the connection fails with the server and this is a network failure. If you have deployed the Datashield stack with Docker it is possible that the operating system settings forbids outbound connections from a containerized app. You should contact your sys admin to verify that.

Regards
Yannick

Thank you for you response. I will check that. But In the meantime when create the resource using the url of the data in stored in Github

resource_url="https://github.com/isglobal-brge/dsOmics/raw/refs/heads/main/data/ethnic_snps.rda

#load data as resource   
opal.resource_create(connections,  project_name , resource_name, url = resource_url, format = "matrix")
opal.resource_perm_add(connections,  project_name, resource_name, subject = users, type = "group", permission = "view")

The as.resource.object is successfull.

datashield.assign.expr(conns = conns, symbol = "D",
                            expr = as.symbol("as.resource.object(rse)"))

Is routine to connect to file outside the network (example. Github) different from accessing a file within the opal server?

It all depends on the IP rules on your system. I just tried your script on opal-demo and it works as expected.

Regards
Yannick

1 Like