Coming from the v3 SDK, I’m struggling to get a very basic script working with the Sendbird Chat v4 SDK for JavaScript. The sb.connect()
line seems to always throw a TypeError
.
Code:
import SendbirdChat from '@sendbird/chat';
import {
GroupChannelModule,
type SendbirdGroupChat,
} from '@sendbird/chat/groupChannel';
const APP_ID = '...';
const USER_ID = '...';
(async () => {
var sb = SendbirdChat.init({
appId: APP_ID,
modules: [new GroupChannelModule()],
}) as SendbirdGroupChat;
const user = await sb.connect(USER_ID);
console.log(user);
})();
Traceback:
TypeError: Cannot read properties of undefined (reading 'transaction')
at t._getObjectStore (file:///Users/danpro/Desktop/sb/node_modules/@sendbird/chat/__bundle-8a2944ef.js:1:88684)
at file:///Users/danpro/Desktop/sb/node_modules/@sendbird/chat/__bundle-8a2944ef.js:1:89316
at new Promise (<anonymous>)
at t.<anonymous> (file:///Users/danpro/Desktop/sb/node_modules/@sendbird/chat/__bundle-8a2944ef.js:1:89281)
at file:///Users/danpro/Desktop/sb/node_modules/@sendbird/chat/__bundle-d526f35e.js:1:2257
at Object.next (file:///Users/danpro/Desktop/sb/node_modules/@sendbird/chat/__bundle-d526f35e.js:1:2362)
at file:///Users/danpro/Desktop/sb/node_modules/@sendbird/chat/__bundle-d526f35e.js:1:1278
at new Promise (<anonymous>)
at i (file:///Users/danpro/Desktop/sb/node_modules/@sendbird/chat/__bundle-d526f35e.js:1:1023)
at t._getRaw (file:///Users/danpro/Desktop/sb/node_modules/@sendbird/chat/__bundle-8a2944ef.js:1:89178)
Node.js v19.8.1
What could be the cause of this error?