Error: Amity SDK (400100): The argument 'encoding' is invalid for data of length 9. Received 'hex'


getting this error while trying to log in user to the Amity platform following is the code of the file:-

import { isServer } from ‘@/constants/index’;
import { useRootStore } from ‘@/providers/RootStoreProvider’;
import { useUser } from ‘@auth0/nextjs-auth0/client’;
import { useRouter } from ‘next/router’;
import { useEffect } from ‘react’;
import useSWR from ‘swr’;
import { User } from ‘@/types/User’;
import { fetcher } from ‘@/utils’;
import { Client, API_REGIONS, UserRepository } from ‘@amityco/ts-sdk’;

const client = Client.createClient(${process.env.AMITY_API_KEY}, API_REGIONS.US);

const sessionHandler: Amity.SessionHandler = {
sessionWillRenewAccessToken(renewal) {
renewal.renew();
},
};

const handleConnect = (userId: string, displayName: string) => {
console.log(userId, displayName);
console.log(‘handleconnect 3’);
return Client.login({ userId, displayName }, sessionHandler)
.then(() => {
console.log(‘handleconnect 4’);
});
};

function UserWatcher() {
const rootStore = useRootStore();
const { user: authUser, isLoading, checkSession } = useUser();
const router = useRouter();
useEffect(() => {
if (!isServer && authUser) rootStore.initialize();
}, [authUser]);

const { data: userData, isLoading: isLoadingUserData } = useSWR(‘/api/users/me’, fetcher);

useEffect(() => {
if (!isLoadingUserData) {
if (userData === null && !router.pathname.startsWith(‘/wizard’)) {
router.push(‘/wizard/affiliations’);
} else if ((userData && router.pathname.startsWith(‘/wizard’)) || router.pathname === ‘/’) {
console.log(userData)
console.log(userData?.email);
console.log(‘handleconnect 1’)
handleConnect(${userData?.email}, ${userData?.name});
console.log(‘handleconnect 2’)
router.push(‘/projects’);

  }
}

}, [userData, isLoadingUserData, router]);

useEffect(() => {
// attempt to silently log in a authUser who has an active session on another simwin website
(async () => {
if (!authUser && !isLoading) {
await fetch(‘/api/silent-auth’, { mode: ‘no-cors’ });
if (checkSession) checkSession();
}
})();
}, [checkSession, authUser, isLoading]);

return null;
}

export default UserWatcher;

and here is the image of what I am getting in the console

Hello, we have passed this to our team to help check, will keep you posted, thank you.

Could you try passing apikey directly in this line: Client.createClient(${process.env.AMITY_API_KEY}, API_[REGIONS.US](http://regions.us/)); , please?