ERROR

TypeError: Cannot call method 'toString' of undefined" in Park and Recreation Finder

Last Published: April 25, 2020

Error Message

The following error message is returned in the Park and Recreation Finder application when one of the 'Share this map' options (Facebook, Twitter, or email) is clicked.

“TypeError: Cannot call method 'toString' of undefined”

Note:
This error applies to the Park and Recreation Finder (ArcGIS 10) download.

Cause

The share map options in the Park and Recreation Finder use a URL-compacting service called json-tinyurl.appspot.com. This service can fail when it reaches one of its daily quotas. When this happens, the share map feature fails until the service's usage counts are reset at 12:00 AM the next day.

Solution or Workaround

Change the application's URL-compacting service from using json-tinyurl.appspot.com to a different URL-compacting service.

One alternative service is bit.ly. If bit.ly is selected to replace json-tinyurl.appspot.com, it is necessary to make a one-time change to the Park Finder's software because bit.ly returns a more structured response. After this change, the software can handle either service: json-tinyurl.appspot.com or bit.ly.

  1. Navigate to ParkRecreationFinder > Application > ParkFinder and open Config.txt for editing.
  2. Replace the text

    Code:
    "URL": "http://json-tinyurl.appspot.com/?url=${0}" , "ResponseAttribute": "tinyurl",

    with

    Code:
    "URL": "http://api.bit.ly/v3/shorten?login=esri&apiKey=R_65fd9891cd882e2a96b99d4bda1be00e&uri=${0}&format=json" , "ResponseAttribute": "data.url",

    and save the file.
  3. Open JS\Utils.js for editing.
  4. Delete line 83.

    Code:
    var tinyUrl = data[tinyURLServiceURL.ResponseAttribute];

  5. Insert the following lines in place of line 83

    Code:
    var tinyUrl = data;
    // Follow a chain of nested attributes if necessary
    var attr = tinyURLServiceURL.ResponseAttribute.split(".");
    for (var x = 0; x < attr.length; x++) {
    tinyUrl = tinyUrl[attr[x]];
    }

    and save the file.

Article ID:000011557

Software:
  • ArcGIS for Local Government

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options