# ASCError: ASCWebSDK: Only one instance of the SDK Web Client can be created

**URL:** <https://forum.social.plus/t/ascerror-ascwebsdk-only-one-instance-of-the-sdk-web-client-can-be-created/779>\
**Category:** Web\
**Created:** [June 22, 2023, 8:15am UTC](https://forum.social.plus/t/ascerror-ascwebsdk-only-one-instance-of-the-sdk-web-client-can-be-created/779 "2023-06-22T08:15:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![coventi](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@coventi](https://forum.social.plus/u/coventi)\
**Post date:** [June 22, 2023, 8:15am UTC](https://forum.social.plus/t/ascerror-ascwebsdk-only-one-instance-of-the-sdk-web-client-can-be-created/779/1 "2023-06-22T08:15:57Z")

</div>

Can anyone help me out, I’ve been stuck on this for days. I tried implementing the ReactJS chat using this [https://codesandbox.io/s/github/AmityCo/Amity-Social-Cloud-Web-Sample-Apps/tree/main/messaging-app-with-CRA?file=/src/ascClient.js:0-636](https://codesandbox.io/s/github/AmityCo/Amity-Social-Cloud-Web-Sample-Apps/tree/main/messaging-app-with-CRA?file=/src/ascClient.js:0-636) on a NextJS app.  
Each time I load the page I keep getting

```auto
Server Error
ASCError: ASCWebSDK: Only one instance of the SDK Web Client can be created

This error happened while generating the page. Any console logs will be displayed in the terminal window.

```

I cant figure to why this is happening.

---

<div class="post-metadata">

**Author:** ![cijin](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@cijin](https://forum.social.plus/u/cijin)\
**Post date:** [June 22, 2023, 11:04am UTC](https://forum.social.plus/t/ascerror-ascwebsdk-only-one-instance-of-the-sdk-web-client-can-be-created/779/2 "2023-06-22T11:04:21Z")

</div>

Hey @coventi,

If you are just starting out I’d recommend you use the `Typescript SDK` instead.  
`npm i @amityco/ts-sdk`

To achieve the same as above you could use this snippet:

```auto
import { Client } from '@amityco/ts-sdk'

(async () => {
  const sessionHandler: Amity.SessionHandler = {
    sessionWillRenewAccessToken(renewal: Amity.Renewal) {
      renewal.renew();
      /*
       * If using an auth token
       *
       * try {
       * renew.renewWithAuthToken(authToken)
       * } catch() {
       * sdk will try to renew again at a later time
       *
       * renew.unableToRetrieveAuthToken()
       * }
       */
    },
  };
  const client = Client.createClient(API_KEY, API_REGION)

  let isConnected = await Client.login({ userId: USER_ID }, sessionHandler)
})()

```

---

<div class="post-metadata">

**Author:** ![coventi](https://avatars.discourse-cdn.com/v4/letter/c/6f9a4e/32.png) [@coventi](https://forum.social.plus/u/coventi)\
**Post date:** [June 24, 2023, 3:48am UTC](https://forum.social.plus/t/ascerror-ascwebsdk-only-one-instance-of-the-sdk-web-client-can-be-created/779/3 "2023-06-24T03:48:55Z")

</div>

This has sorted out the issue. Thanks Cijin

---

<div class="post-metadata">

**Author:** ![cijin](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@cijin](https://forum.social.plus/u/cijin)\
**Post date:** [June 26, 2023, 3:43am UTC](https://forum.social.plus/t/ascerror-ascwebsdk-only-one-instance-of-the-sdk-web-client-can-be-created/779/4 "2023-06-26T03:43:30Z")

</div>

Amazing! Please let me know if there are any other issues.

Happy to help.

Cijin
