Calling compute endpoints giving error

Hii I have created a aws virtual machine and deployed the rhino compute by creating api key and auth token. I have been calling the health check api from my js code but it is giving me following error

I have give RhinoCompute.url = ‘http://(vm machine ip):80/’ and also given RhinoCompute.apikey= ‘my key’

I don’t know exactly what your request header looks like, but it doesn’t appear as though the key your using for your API key is set correctly. The header should include a key/value pair where the key is called RhinoComputeKey and the value is whatever you set your API key to when you ran the bootstrap script. Does this help?

Thanks Andy this worked.

1 Like

Hi Andy

I was wondering why the key name in js compute-rhino-3dm package is wrong. because of that I was not able to get the results. Is there anything we can do here ?

if you see here there key is ‘apiKey’ instead of ‘RhinoComputeKey’

I added an example with all of the existing tools: https://github.com/mcneel/rhino-developer-samples/tree/8/compute/js/node/SampleHealthCheck.

I am not sure exactly what your issue is, but the healthcheck endopoint does not return json, so the call should be:

const res = await RhinoCompute.computeFetch('healthcheck', null, false) //healthcheck does not return json

Here is the src.
Note: I use the dotenv package to read the RHINO_COMPUTE_URL and RHINO_COMPUTE_KEY vars from a .env file.

import 'dotenv/config'
import RhinoCompute from 'compute-rhino3d'

RhinoCompute.url = process.env.RHINO_COMPUTE_URL
RhinoCompute.apiKey = process.env.RHINO_COMPUTE_KEY

try {

    const res = await RhinoCompute.computeFetch('healthcheck', null, false) //healthcheck does not return json
    const txt = await res.text()
    console.log(txt)

} catch (error) {

    console.error(error)

}