none
Uncaught TypeError: Cannot read property 'credentials' of undefined

    Question

  • Hi,

    I am having problem making the example work. The code is below. I have removed the KEY to this post. But i have tried with two keys and the same results. It fails in both Chrome and IE. 

    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <meta charset="utf-8" />
    <!-- Reference to the Bing Maps SDK -->
    <script type='text/javascript'
    src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=KEY'
    async defer></script>
    <script type='text/javascript'>
    function GetMap()
    {
    var map = new Microsoft.Maps.Map('#myMap');
    //Add your post map load code here.
    }
    </script>
    </head>
    <body>
    <div id="myMap" style="width:600px;height:400px;"></div>
    </body>
    </html>

    The error is

    Uncaught TypeError: Cannot read property 'credentials' of undefined. 

    Thanks,

    Alexis

    Wednesday, November 28, 2018 6:00 PM

All replies

  • I'm getting the same error. Looks like a recent issue.
    Wednesday, November 28, 2018 6:07 PM
  • Hi Folks,

    If you have a space in front of your key the call will fail.  Can you confirm that the key has no leading spaces?  If you email MapLic@Microsoft.com they should be able to look at your account with you and see if there are any issues with your key or account.

    Sincerely,

    IoTGirl


    Thursday, November 29, 2018 7:04 PM
    Owner
  • for some silly reason, the Map needs to have second parameter with map settings even if it is an  empty object...

    var map = new Microsoft.Maps.Map('#myMap', {});
    worked in my case
    Thursday, December 6, 2018 12:12 PM