diff --git a/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx b/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx index 135c280c85..7796bc850f 100644 --- a/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx @@ -25,6 +25,7 @@ class JoinHandler extends Component { super(props); this.fetchToken = this.fetchToken.bind(this); this.changeToJoin = this.changeToJoin.bind(this); + this.numFetchTokenRetries = 0; this.state = { joined: false, @@ -40,6 +41,19 @@ class JoinHandler extends Component { } async fetchToken() { + if (!Meteor.status().connected) { + if (this.numFetchTokenRetries > 9) { + logger.error({ + logCode: 'joinhandler_component_joinroutehandler_error', + extraInfo: { + numFetchTokenRetries: this.numFetchTokenRetries, + }, + }, 'Meteor was not connected, retry in a few moments'); + } + this.numFetchTokenRetries += 1; + + setTimeout(() => this.fetchToken(), 200); + } const urlParams = new URLSearchParams(window.location.search); const sessionToken = urlParams.get('sessionToken'); @@ -102,7 +116,6 @@ class JoinHandler extends Component { meetingID, internalUserID, customdata, } = resp; - return new Promise((resolve) => { if (customdata.length) { makeCall('addUserSettings', meetingID, internalUserID, customdata).then(r => resolve(r)); diff --git a/bigbluebutton-html5/imports/ui/services/api/index.js b/bigbluebutton-html5/imports/ui/services/api/index.js index 80881ebc9e..db06d89968 100755 --- a/bigbluebutton-html5/imports/ui/services/api/index.js +++ b/bigbluebutton-html5/imports/ui/services/api/index.js @@ -11,12 +11,12 @@ import { notify } from '/imports/ui/services/notification'; * @return {Promise} */ export function makeCall(name, ...args) { - if (Meteor.status().connected) { - check(name, String); + check(name, String); - const { credentials } = Auth; + const { credentials } = Auth; - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { + if (Meteor.status().connected) { Meteor.call(name, credentials, ...args, (error, result) => { if (error) { reject(error); @@ -24,9 +24,10 @@ export function makeCall(name, ...args) { resolve(result); }); - }); - } - return null; + } else { + reject(new Error('Meteor was not connected')); + } + }); } /**