Can't join conversation channel in react typescript web app

1)I am trying to join a channel (it exists because I checked it through getChannel). It is throwing Error: Amity SDK (400300): Can’t join the conversation channel at new ASCApi.

Below is the code I am trying to fetch
const onJoinChannel = async (channelId) => {
console.log(‘in the join’);
try {
const query = await createQuery(joinChannel, channelId);
runQuery(query, result => console.log(result));
} catch (err) {
console.log(err);
}
}

2)Is there any way to wait till loading gets false and returns data while create,get,join channel and then move to the next line of code

@ManishDhameja

Per #1, this is actually expected behaviour for with conversation channels only a maximum of 2 users are allowed to join. We’ve tested and joining user to community group work as usual.

You can use createChannel with conversation type because if it’s the same user the sdk will return the same channelId

Amity Support

@ManishDhameja

Per #2, you can use promise for this, please find code:

export const onJoinChannel = async (channelId) => {
    console.log('in the join');
    return await new Promise(async (resolve, reject) => {
    try {
        const query = await createQuery(joinChannel, channelId);
        runQuery(query, result => {
            if(!result.loading){
                resolve(result.data)
            }
        });
    } catch (err) {
        console.log(err);
        reject(err)
    }
})
}

Thank you,
Amity Support