I have several cmv widgets enabled, some I have built myself. All work great, but when I enable the Measurement widget I am getting this error upon loading the app:

dojo/parser::parse() error TypeError: Cannot read property 'toString' of undefined

Uncaught Error: uniqName_4: parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin. Must pre-load all supporting widgets before instantiation.

Here is my configuration:

  measure: { 
    include: true,
    id: 'measurement',
    type: 'titlePane',
    canFloat: true,
    path: 'gis/dijit/Measurement',
    title: '<i class="fa fa-share-alt fa-lg"></i> <i>&nbsp;&nbsp; Measure</i>',
    open: false,
    position: 4,
    options: {
      map: true,
      mapClickMode: true,
      defaultAreaUnit: units.ACRES,
      defaultLengthUnit: units.FEET
    }
  }

Any ideas what the problem might be?

  • Does this still occur when you do not include your custom widgets? – tmcgee Feb 10 '16 at 20:17
  • I will test that. I should also mention that this error does NOT occur every time I load the app, maybe 20% of the time. – its30 Feb 10 '16 at 20:25

This is most likely a timing issue related to the loading of dojo module dependencies. Check your custom widgets to ensure that all the dojo dijits in the html template file are included in the modules required in your widget Javascript file. That is most often the cause.

  • Thanks, I checked the dojo module dependencies on my custom widgets and everything looked OK there. After further testing, although less frequent, I still get an intermittent Cannot read property 'toString' of undefined error. This error occurs without my custom widgets included in the app. Not sure what the problem is but it seems specific to the measurement widget. I will continue testing and looking for the issue. – its30 Feb 11 '16 at 14:02
  • Does this toString error affect your application? I have also seen this error intermittently. Here's one possible cause and solution: geonet.esri.com/thread/81475 Not sure if that applies to your case. – tmcgee Feb 11 '16 at 23:31
  • I haven't found any noticeable affects with the toString error. It occurs much less frequently than the Uncaught Error: uniqName_4: parser returned unfilled promise error so I am not too concerned about it. I will check out that link though, thanks. – its30 Feb 12 '16 at 17:05

Having spent some time investigating this due to my own issues, it seems to be a problem with esri/dijit/Measurement itself. Just by editing the widget and commenting out the require the errors disappear (and the widget itself breaks, obviously).

This class seems to also mess with dojo's locale system during load, breaking number.parse and such. (Although it seems to fix itself by the time everything is read)

Since esri/dijit/Measurement is handled by ESRI itself, we're kinda screwed.

E: That said, applying the fix mentioned above in the comments reduces the incidence of the errors, although it doesn't seem to solve them entirely.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.