I get error 4002 when I request directions

I get the error 4002 when I request directions using navigation. I have set the api key. How should I solve this problem? Thank you for your help.

The ORS server is working.

  • are you connected to WIFI or Data? The service requires an Internet connection.
  • How? We do not know without seeing your Blocks James. You may have an issue with your code.
  • if you use a LocationSensor to provide one of the inputs for getting a route to another location, you may not have a satellite fix before making your directions request.
  • lots of other stuff.
  • are you using an emulator?

This might help HOW TO: Use the Navigate control

Hi! Thanks for your reply! It's working now! However, I want to know more about some questions you asked (see below)

Here is my code (same as before it is working):


I also use other location to test and it is still working. I forgot to move those blocks out of the "FirebaseDB1. GotValue" event ...:sweat_smile:

Here is the question I want to know more:

Although it is working now, I want to know more about this problem as I am using Location Sensor to provide the starting point. Would it be better to use the location changed event instead of the original one?


Yes, I connected to WIFI

Yes, I am using the Companion on my mobile phone


Thank you for spending time to read my long reply :sweat_smile: :sweat_smile: :sweat_smile:

The error 4002 is like this

Oh! When I put those setting points and requesting directions blocks in the Screen initialize event, the new error 4003 occurred (routing service failed with status 400 Bad Request).

Maybe I make some mistakes like set the start lat to location sensor.lat and then set the start longitude to location sensor.longitude
But I am not sure

Construction with code to ensure satellite fix might look something like this:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.