VROOM-Project/vroom-express

Health check returning 404 while POST requests are fine

trumboosahil opened this issue · 16 comments

http://127.0.0.1:3000/health 404
Cannot GET /health

Where i have to configure vroom in vroom-express

Did you go through the customization section in the readme?

I changed only one variable

path: '/home/multi//vroom/vroom/bin/' Still same issue

You need to provide a bit more context:

  • where does the Cannot GET /health message comes from (what command/action did you perform)?
  • did you start the server?
  • if yes, do you see an error in the console output?

npm start

vroom-express@0.5.0 start /home/multi/routing/vroom/vroomexpress/vroom-express
node src/index.js
vroom-express listening on port 3000!

then when I hit brower with http://127.0.0.1:3000/health

Cannot GET /health

even below command results same things

curl -w "%{http_code}" http://localhost:3000/health

<title>Error</title>
Cannot GET /health
404

What if you try the next curl provided in the readme:

curl --header "Content-Type:application/json" --data '{"vehicles":[{"id":0,"start":[2.3526,48.8604],"end":[2.3526,48.8604]}],"jobs":[{"id":0,"location":[2.3691,48.8532]},{"id":1,"location":[2.2911,48.8566]}],"options":{"g":true}}' http://localhost:3000

"code":3,"error":"Failed to connect to 0.0.0.0:5000

one more thing i went to bin directory at terminal and run

`vroom -h

It displays
vroom: command not found

although vroom is present in bin folder`

OK, it means the call to vroom succeeds with the regular POST request (except you have a problem with your OSRM setup).

I suspect this may be related to the third parameter of the spawn command. We're setting shell: true on this call but not for the health check.

Can you add {shell: true} as a third parameter to this call, i.e. apply the following patch:

diff --git a/src/index.js b/src/index.js
index a1646ed..78254d8 100644
--- a/src/index.js
+++ b/src/index.js
@@ -276,7 +276,8 @@ app.get('/health', (req, res) => {
   const vroom = spawn(vroomCommand, [
     '-i',
     './healthchecks/vroom_custom_matrix.json'
-  ]);
+  ],
+                      {shell: true});
 
   let msg = 'healthy';
   let status = HTTP_OK_CODE;

and see if it changes anything after restarting the server?

thanks health check working

but
curl --header "Content-Type:application/json" --data '{"vehicles":[{"id":0,"start":[2.3526,48.8604],"end":[2.3526,48.8604]}],"jobs":[{"id":0,"location":[2.3691,48.8532]},{"id":1,"location":[2.2911,48.8566]}],"options":{"g":true}}' http://localhost:3000

same problem

thanks health check working

You mean adding {shell: true} as a third parameter did solve the problem?

"code":3,"error":"Failed to connect to 0.0.0.0:5000

This error is not related to vroom-express and is the expected response when vroom can't reach out to OSRM for routing queries. You need to properly setup and expose a routing engine (OSRM or Openrouteservice), or provide your own matrices in input as discussed in VROOM-Project/vroom#323.

thanks health check working

You mean adding {shell: true} as a third parameter did solve the problem?
I didn't add any paraemeter.,I cloned git again and it seems I was not having update index.js

"code":3,"error":"Failed to connect to 0.0.0.0:5000

This error is not related to vroom-express and is the expected response when vroom can't reach out to OSRM for routing queries. You need to properly setup and expose a routing engine (OSRM or Openrouteservice), or provide your own matrices in input as discussed in VROOM-Project/vroom#323.

Let me check it

thanks health check working

You mean adding {shell: true} as a third parameter did solve the problem?
I didn't add any paraemeter.,I cloned git again and it seems I was not having update index.js

"code":3,"error":"Failed to connect to 0.0.0.0:5000

This error is not related to vroom-express and is the expected response when vroom can't reach out to OSRM for routing queries. You need to properly setup and expose a routing engine (OSRM or Openrouteservice), or provide your own matrices in input as discussed in VROOM-Project/vroom#323.

Let me check it

i get error {
"code": 3,
"error": "Invalid routing response: HTTP/1.1 403 Forbidden\r\nContent-Length: 0\r\nServer: AirTunes/750.14.1\r\n\r\n"
}

when i send this to localhost:3000/

{
"vehicles": [{"id": 1, "start": [54.6872, 25.2797], "end": [54.6872, 25.2797]}],
"jobs": [{"id": 1, "location": [54.6863, 25.2816]}, {"id": 2, "location": [54.6921, 25.2335]}]
}

i have set up osrm on docker desktop and the vroom localy..

Airtunes 😄 looks like you got the routing server misconfigured.

You mean osrm/backend on docker correct ? 🥲

Thanks need to disable airtunes receiver as it is on localhost:5000

Might be easier to change osrm port to 5001 or so. Apple hijacked port 5000 a while ago, which is a good reminder that they don’t care about developers at all