[Solved] Azure Maps API Error

Hi y’all! I’ve got a weird bug with an app that I’m working on. I’m getting the speed limit of a road from the Azure Maps API and have all that set up, except for some reason I get an error (attached) the first time I load it, but if I switch pages to another page and then go back, I get my expected result. I’ve tried calling the GetSpeedLimit function more than once and with a delay between them to see what was going on but that still doesn’t seem to fix it. I’ve attached the problem code snippets and error/expected output. If anyone has any ideas on what is going on I could definitely use the help!

Note: I know that in the screenshots my expected output doesn’t include the speedLimit key, I’m doing the testing from a hotel and not a road (I would prefer to not be run over :))

1 Like

You need to put the Web API call inside the “then do” section of the Location Sensor call. Those blocks will run immediately regardless of any delay in processing the commands inside them. So even though in your mind I’m sure you’re assuming the Web API Get block runs after the call Location_Sensor1 block runs, that’s not necessarily the case. Putting the Web API block in the “then do” section ensures that.

If it still doesn’t work after that, post the API response (seen in your last screenshot) as text and I can help you out.


Thank you so much! I assumed that they were run sequentially but apparently not!

1 Like

You’re welcome! Here’s some interesting reading about this issue:

1 Like