I'm unable to reproduce this error. Looking at the style URL you provided, I noticed that "mcv=235", but the current version of Azure Maps has "mcv=311". Not sure if that makes any difference in the style. I believe "mcv" is short for "map control version", so that would mean you are using version 2.3.5, while the current version is 3.1.1. So it's possible that the older version is the issue here. I'm not sure if there are any breaking changes between v2 and v3, but there is a newer v2 out there (2.3.6), and I do recall there being some styling issues previously, so likely corrected in a newer version. I would start by trying the version 2.3.6 of the MPN package, and if you still see the error, try the latest version.
Internal caused "expected value to be of type number but found null instead" warning coming in my console
I have a web app with client written on React. I use azure-maps-control@2.3.5
npm package to show the map. I give user zoom in & out buttons and pan option to navigate the map.
I see a lot of warnings "Expected value to be of type number but found null instead", they all lead to obfuscated code. However after debugging I believe that the warning is about a value that comes from Microsoft directly. Here are my findings:
- The error comes from line 5143 (for me)
- The catched error comes from
this.expression.evaluate(this._evaluator)
- It throws in line 3482 (for me) when comparing
this.type
to the actual value (I think). In properties ofthis
I can see the name of the parameter that is being checked. The name is alwaysname-f
every time the warning appears. - I have no entry of name-f in my codebase, neither I could find it in the package code. However I found it in API responses. The URL is https://atlas.microsoft.com/styling/styles/road?styleVersion=2023-01-01&mcv=235&api-version=2.0 . So it's internal Azure Maps call to its API.
- The response you can see in the images. There are around 30 entries of
name-f
there, one for each layer I suppose. I think I see the problem with it. On internet they suggest to wrap style conditions like:
['get', 'propertyName']
into
[
'case',
['has', 'propertyName'],
['get', 'propertyName'],
defaultValue
]
For example, see question https://learn.microsoft.com/en-us/answers/questions/1442464/error-loading-azure-maps
However you can see on the screenshot, it is not done in the response. The bare ['get', 'name-f']
returns null
for text-size
I assume and that's why I see sometimes hundreds of these warnings, especially when zooming and panning a lot in a short time.
My questions are:
- Can I do something to fix the invalid
text-size
? - Can I do something to omit the warning?
- Is there a bug reporting system for Azure Maps where I can show it?
Azure Maps
1 answer
Sort by: Most helpful
-
rbrundritt 20,921 Reputation points Microsoft Employee Moderator
2024-02-14T17:58:53.46+00:00