# \[Solved\] Azure Maps API Error

**URL:** https://community.thunkable.com/t/solved-azure-maps-api-error/1348935
**Category:** Questions about Thunkable X
**Tags:** googlemaps, solved
**Created:** [June 16, 2021, 9:32pm UTC](https://community.thunkable.com/t/solved-azure-maps-api-error/1348935 "2021-06-16T21:32:04Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![nickbrozaznkhy](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@nickbrozaznkhy](https://community.thunkable.com/u/nickbrozaznkhy)
#### Post date: [June 16, 2021, 9:32pm UTC](https://community.thunkable.com/t/solved-azure-maps-api-error/1348935/1 "2021-06-16T21:32:05Z")

</div>

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 :))

 ![Code](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/9/b9eeb965787c8fca22efc0dcde51a76d869f678a.png)  
 ![Error_Load1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/9/49a3e606eefc32689245a4cc32dab7c4e069759c.png)  
 ![Expected_Load2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/4/846ad830c28041d9c546758e12abe5e12b5e0423.png)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [June 16, 2021, 10:22pm UTC](https://community.thunkable.com/t/solved-azure-maps-api-error/1348935/2 "2021-06-16T22:22:02Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![nickbrozaznkhy](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@nickbrozaznkhy](https://community.thunkable.com/u/nickbrozaznkhy)
#### Post date: [June 16, 2021, 10:48pm UTC](https://community.thunkable.com/t/solved-azure-maps-api-error/1348935/3 "2021-06-16T22:48:48Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [June 17, 2021, 12:23am UTC](https://community.thunkable.com/t/solved-azure-maps-api-error/1348935/4 "2021-06-17T00:23:21Z")

</div>

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

> [@Wrapping Asynchronous (then do) blocks into a Synchronous Function resolves unpredictable results](https://community.thunkable.com/t/wrapping-asynchronous-then-do-blocks-into-a-synchronous-function-resolves-unpredictable-results/910511):
>
> Thunkable provides an extensive library of calls to external services including Google Docs and Web APIs. These external calls are, by necessity, asynchronous calls. That is, the request is sent to the external serivce, Thunkable block execution continues on it’s merry way, then the external service sends a reply. Thunkable wraps the external calls in in blocks with “Then Do” sections. This is a massive improvement over separate call and response block (MIT App Inventor), but it is not without …

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:20pm UTC](https://community.thunkable.com/t/solved-azure-maps-api-error/1348935/6 "2024-11-08T13:20:14Z")

</div>


