Sendbird connection error issue (jQuery)

Hi guys, I am trying to connect to sencbird server but I got this error and cannot resolve it. the error is like below.

“Uncaught TypeError: Cannot read property ‘get’ of undefined”

The code I wrote is below.

<script>
sb = new SendBird({
    appId: "xxyyzz"
});
sb.connect("x", "bb", function(user, error) { console.log(error); });
</script>

And also posting the sentry error report also.

How could I handle this error?

Thanks in advance :slight_smile:

Hi Moomoo

Please refer to this official page and download the SDK.

  1. Create an HTML (remember you need to include Axios)
  <html>
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width">
      <title>JS Bin</title>
      <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
      <script src="./sdk/SendBird.min.js"></script>
      <script src="index.js"></script>
    </head>
    <body>
    </body>
    </html>
  1. Create your index.js
var sb = new SendBird({ appId: "..." });
sb.connect("test1", function(user, error) { console.log(user); }); 

Note: Try to use a userId (“test1” in my case) that exists in your Dashboard.

1 Like

Thanks walter!

      <script src="https://unpkg.com/axios/dist/axios.min.js"></script>

the code above fix my problem! thanks a lot :smiley: