Unable to integrate Amity into Next.Js

When installing the package npm install @amityco/js-sdk --save on my next Js application.

I am getting error
Could not find a declaration file for module ‘@amityco/js-sdk’. ‘/Users/macbook/Documents/GitHub/numen-store-front/node_modules/@amityco/js-sdk/build/client.min.js’ implicitly has an ‘any’ type.
Try npm i --save-dev @types/amityco__js-sdk if it exists or add a new declaration (.d.ts) file containing declare module '@amityco/js-sdk';

The code is written in Javascript.
Thus not able to connect to the client using:-

const sessionHandler = {
async sessionWillRenewAccessToken(renewal) {
try {
const updatedAuthToken = await getAuthToken();

  renewal.renewWithAuthToken(updatedAuthToken);
} catch (error) {
  renewal.unableToRetrieveAuthToken();
}

},
};
const authToken = await getAuthToken();

client.registerSession({
userId: ‘userId’,
displayName: ‘Bob Newton’,
authToken,
sessionHandler,
});

Hi @SUshant ,

Which version JS does this occur on?

Amity Support

“react”: “^17.0.1”,
“next”: “^10.0.2”,

The issue is resolved for now. I am able to connect with amity

1 Like