Select to view content in your preferred language

JS API 3.14 token error

3510
7
10-27-2015 04:13 PM
by Anonymous User
Not applicable

Hi - I am pretty sure this is the init.js page of the 3.14 API (and not my own scripts...but who knows).

There's an unexpected token error in the console log (Chrome) - an out of place semi-colon. I'm having a hard time finding it because the API layer file is uglified/minified/built and all those good things.

This started popping up a bit ago and I assumed I'd done something via my scripts, but I just started hosting the API locally and it's pointing right at the init.js file.

Thanks for any fixes!

0 Kudos
7 Replies
KellyHutchins
Esri Frequent Contributor

Sarah Clark​ I don't see this error in the samples so I suspect its something in your code. Do you have a link to your app? Or can you provide the code?

0 Kudos
by Anonymous User
Not applicable

Unfortunately it is an internal app that I cannot share. Sometimes the error only shows after zooming in/out a bit...I'll assume it's my code.

0 Kudos
KellyHutchins
Esri Frequent Contributor

Sarah Clark

If you can make a simplified version of your app that shows the problem I'd be happy to take a closer look.

0 Kudos
KellyHutchins
Esri Frequent Contributor

You may already be aware of this but thought I'd mention it in case you aren't. You can often get more info about what's going on using the browser's dev tools. In cases like this where an error is pointing to a line in init.js sometimes if you expand the error in the console you'll see additional details including perhaps a line of code in your app that is causing the problem. I put together a test app that tries to add an empty feature layer to the map. If I run the app the initial error is 'Cannot read property 'path' of null and it points to line 1690 of init.js. But if I go to the console and expand the error I can see that it refers to line 101 of my code (maximize_popup.html).

Screen Shot 2015-10-28 at 4.01.48 PM.png

Another debugging tip for issues like these is to check the 'Pause on Exception' option available in dev tools then run your code. This will cause the app to pause when it hits an exception and you can look at the call stack which often also shows the line in your app that is causing the error. In Chrome the button you click on looks like a gray stop sign with a pause image. When activated it will turn blue and pause on the exception. Then if you look at the call stack you'll see it references line 101 of maximize_popup.html.

Screen Shot 2015-10-28 at 4.03.29 PM.png

by Anonymous User
Not applicable

Hi Kelly - Thanks. Yes I love the Dev Tools, that's how I caught the error. The issue is that it only references init.js, not my code, but that's happened before with my own errors

0 Kudos
DavidElies
Deactivated User

I recently started seeing this, too.  For me, it's coming from the World Street Map TileMap request.  For some reason, this request has a jsonp callback added to it, but since it returns regular json (an object, not a function), it seems to fail trying to run it.  We actually use the API v3.10, which gives a slightly different error, but when I tried it with v3.14, I get the same error as the OP. Kelly Hutchins, do you know what has changed recently in the World Streep Map map service?

0 Kudos
KellyHutchins
Esri Frequent Contributor

David Elies​ do you have a test app that shows the problem? I tried to repro with this sample from the help but no luck.

Create a Map

0 Kudos