"Api Key was not provided." despite including API key in header

Hi @AndyPayne

I’m getting an “Api Key was not provided.” whenever I try to access my compute aws server. Pinging the server works fine but I’m running into the issue with the /version and /healthcheck endpoints and with both GET and POST.

For debugging, I tried sending the RhinoComputeKey using Postman with the same result. I also tried changing the API key in the VM environmental variable.

Hi @NBB Did you get resolved on this ? I am hitting this same issue for my Azure VM setup.

I’ve attached a screenshot of how I usually setup Postman to send a GET request to my VM. The first thing is setting up the correct address… it should be a GET request sent to the IP address of your VM, then a colon and then the port number 80 and finally followed by the endpoint you want to hit. In this case, I’m sending a test request to the /healthcheck endpoint. Also, then notice that I’ve clicked on the Headers tab and created a new Key called RhinoComputeKey and then in the Value section you would enter the API key that you provided during the bootstrap script. If you can’t remember this, you can find it as one of the entries in your Environment Variables on the VM. If you send this with all the proper info, hopefully you’ll receive a “Healthy” message returned.

The /healthcheck endpoint just reports on the status of the main rhino.compute webserver on the VM… but by default the main process which handles the execution of commands is the compute.geometry project. The main rhino.compute project handles spinning the child processes of compute geometry up and down as needed. To test if the children are working, I would then recommend sending a second request to the endpoint /activechildren. This will return an integer value of the number of child processes that are currently running. The default should be 4… I do want to note that if the server is just starting up these children, the response time can take a little while (as it’s essentially launching four instances of rhino/grasshopper in the background).

1 Like

Thanks Andy - i just didn’t realise that Compute had been updated to require the API key in every call - it used to have some open api points such as /version /sdk etc and i have been in the habit of using my browser to quickly check these endpoints to confirm my older server install was responsive.
Thanks and sorry for silly query.
d

Is the request header’s format key called RhinoComputeKey? I input it according to the picture, but it still says Unauthorized.


I think there might be an issue with your server deployment.

It should be under headers tab, not params?


I found it. But the activechildren is 0. When making a local request to call compute geometry, it seems that the remote end is unable to respond.

Are you only using the Compute.Geometry process? Or the Rhino.Compute process when you run your web server? The reason why I ask is you mention making a call to “compute geometry”.

Let me see if I can explain the architecture of how Rhino.Compute (as a web server) is setup. Rhino.Compute is made up of two Visual Studio projects. The first (which we’ll call the parent process) is called Rhino.Compute. The second (which we can call the child process) is called Compute.Geometry.

When the web server is started, it launches the parent process whose primary job is simply to listen for incoming HTTP requests. If it receives a request to an endpoint, such as /activechildren, it first tries to validate the request using the API key in the header. If the request is valid, then it checks to see if any child processes are running. If none are running, it will begin the process of starting one or more of the child processes.

The children are the ones who are doing the actual geometry calculations. They’re the main workhorses here. By sending a request to the /activechildren endpoint, it will begin spinning up the child processes if none are running. The response will initially be zero if none were actually running when it received the request. However, if you wait a short time (maybe 30 seconds) and then send the request again, then hopefully you should see an integer value greater than zero if it successfully launched some of the children.

Now, the reason I asked whether you were running Rhino.Compute vs. Compute.Geometry is that the first is responsible for spinning up/down the children. But, it seems like maybe you are launching only one of the children separate from the parent. Which is doable, but not the preferred way to do things. Can you explain how you’re running your local Rhino.Compute webserver?

FWIW, the easiest way to get started is to install the Hops package via the package manager. This plugin will also install Rhino.Compute on your machine and every time you launch Grasshopper, it will also start an instance of Rhino.Compute in the background. This is hidden by default, but you can tell the Rhino.Compute console to be visible through the Hops settings under the Grasshopper preferences section. But, simply launching Grasshopper should automatically start an instance of Rhino.Compute and then you can use Postman (or whatever client you want) to send requests to that web server. Does that make sense? The URL for the web server launched by Grasshopper should be reachable at http://localhost:6500:80

Thanks for your reply. I think maybe rhino.compute is not configured correctly on my server. I am trying to reinstall it. Thanks!

Hi. I just configured the rhino.compute on my server and I followed the instructions strictly. After I finished,I use postman to check if the compute configured correctly. When I first send the request to the /activechildren endpoint, I received 0. And after several secs I send it again , I received 1. I thought I configured successfully. But after a few minutes, I test it again. I always reveice 0. The task manager on server seems no rhino.compute is listening.


The IIS on server looks like this. I do not know what went wrong.

Could you give me some help? I think you are the most experienced developer in this area. Any help whould be very appreciated!

When you log into your VM, are you able to launch Rhino normally? For example, can you click on the Rhino shortcut link on the desktop of your VM and launch Rhino that way. I just want to confirm that it is able to get the license correctly.

NO. It says license cant find. It doesnt even give me an opportunity to log in. But the official tech helper in China says this is normal on the server side.

Well it sounds like you didn’t setup (or add your) core-hour billing token correctly. You’ll need to add it manually. Please follow these instructions on how to add your token to an environment variable https://developer.rhino3d.com/guides/compute/core-hour-billing/#using-core-hour-billing

!I think i forgot it. Thanks!

Hi. Good news is that I successfully configured rhino.compute. But I found that the compute.geometry memory can not free automatically.


I have stopped all the application related to rhino. But the memory on service is still very high. I want the memory to be free automatically.
Any help would be very appreciated!

Unfortunately that is the memory that is consumed by each child process that is running. You can either reduce the number of children you have running or increase the total memory that you have on your VM.

So even the compute.geometry has finished the computation procedure, it still can’t free the memory right? I can only decrease the memory by killing the child process manually?

Correct. It’s similar to having 3 or 4 versions of Rhino open and waiting to do a calculation. You can change the idlespan value which will shutdown those processes earlier but you will have to start them back up the next time you send a valid request which will take time to launch those processes

1 Like

OK.I got it. Thanks!