Internal caused "expected value to be of type number but found null instead" warning coming in my console

Aleksandra Emelina 0 Reputation points
2024-02-14T12:28:56.92+00:00

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:

  1. The error comes from line 5143 (for me)
  2. The catched error comes from this.expression.evaluate(this._evaluator)
  3. It throws in line 3482 (for me) when comparing this.type to the actual value (I think). In properties of this I can see the name of the parameter that is being checked. The name is always name-f every time the warning appears.
  4. 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.
  5. 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:

  1. Can I do something to fix the invalid text-size?
  2. Can I do something to omit the warning?
  3. Is there a bug reporting system for Azure Maps where I can show it?

Screenshot 2024-02-14 at 11.34.37Screenshot 2024-02-14 at 11.37.07

Screenshot 2024-02-14 at 11.41.03

Screenshot 2024-02-14 at 11.44.43

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
836 questions
{count} votes

1 answer

Sort by: Most helpful
  1. rbrundritt 20,921 Reputation points Microsoft Employee Moderator
    2024-02-14T17:58:53.46+00:00

    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.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.