Hey there! I realize there have not been any release notes for the 3.1.0, 3.1.1 and 3.1.2 chat releases but since they’re available from NPM and GitHub, I would like to report that they are not recognized by the latest version of the SendBird Desk client (v1.0.19 at the time of this writing). When initializing the SendBird Desk class with the SendBird client class (as per the docs), I get the following error:
SendBirdDeskError: SendBird SDK is missing
This is easily reproducible with the following JS snippet with sendbird-desk
v1.0.19 and sendbird
v3.1.0, v3.1.1 or v3.1.2:
import SendBird from "sendbird";
import Desk from "sendbird-desk";
/**
* @typedef {Object} Connection
* @property {string} accessToken
* @property {SendBird.SendBirdInstance} client
* @property {SendBird.User} user
* @property {string} userId
*/
/**
*
* @param {string} appId
* @param {string} userId
* @param {string} accessToken
* @returns {Promise<Connection>}
*/
function initializeSendbird(appId, userId, accessToken) {
return new Promise((resolve, reject) => {
const client = new SendBird({ appId });
console.debug(`Created SendBird client: `, client);
client.connect(userId, accessToken, (user, err) => {
if (err) {
console.debug(`Could not connect to SendBird servers: `, err);
return reject(new Error(`Could not connect to SendBird: ${err}`));
}
/** @type {Connection} */
const connection = { accessToken, client, user, userId };
console.debug(
`Connected to SendBird servers as connection: `,
connection
);
return resolve(connection);
});
});
}
/**
* @param {Connection} conn
* @return {Promise<Connection>}
*/
function initializeDesk(conn) {
const { accessToken, userId } = conn;
Desk.init(SendBird);
console.debug(`Initialized SendBird Desk with global SendBird class.`);
return new Promise((resolve, reject) => {
Desk.authenticate(userId, accessToken, (result, err) => {
if (err) {
console.debug(
`Could not authenticate with SendBird Desk servers: `,
err
);
return reject(err);
}
console.debug(`SendBird Desk connected and authenticated: `, result);
return resolve(conn);
});
});
}
const example = () => {
const appId = "SENDBIRD_APP_ID";
const userId = "SENDBIRD_USER_ID";
const accessToken = "SENDBIRD_USER_ACCESS_TOKEN";
initializeSendbird(appId, userId, accessToken)
.then(initializeDesk)
.then(
(conn) =>
console.debug(`SendBird is ready for use with connection: `, conn),
(err) => console.error(err)
);
};
With the above snippet running example
, the console shows the following logs:
Created SendBird client: ...
Connected to SendBird servers as connection: ...
SendBirdDeskError: SendBird SDK is missing (stack trace)
The above snippet works with sendbird
v3.0.160 though. I can’t offer any more specific information as the stack trace shows an error on line 6 of SendBird.Desk.min.js
(which is of course minified at source with no source maps available…)
If sendbird
v3.1.x onward will not be compatible with sendbird-desk
, the relevant dependency in package.json
should be updated to reflect this constraint.
Apart from that, I’d love to try out the new local caching features and no longer use the SyncManager but we need the Desk client to work with it though. Any help would be appreciated.