04-04-2022 03:04 PM - edited 04-04-2022 03:19 PM
I'm trying to use getMeeting() when using the Embedded App SDK and am getting undefined as an error coming back from a rejected promise.
How do I troubleshoot this?
Details:
- Webex Meetings Version: 42.3.6.11
- Platform: Mac OS 12.3 (21E230)
Solved! Go to Solution.
04-05-2022 12:35 PM - edited 04-05-2022 12:36 PM
So, I sorted out my issue, but I'm not sure why it worked. here's the code context.
I am using EmberJS to develop my embedded app. To aid in this, I've made an EmberJS Addon (found here, it's still a WIP) which essentially wraps the Embedded App SDK with Ember conventions to enable some data-binding in the templating engine.
When my app boots up, it initializes the addon, which in turn creates an instance of the SDK.
In ADDON:
this._webexInstance = new window.Webex.Application();
...which I then immediately setup the promise chain to respond to the onReady() event:
In ADDON:
this._webexInstance.onReady().then(() => { })
Once the instance reports that it's ready, I then go and fetch the user. Once the user is resolved, I then resolve the promise that was blocking my app from booting.
It was here that I was then calling "getMeeting()" to get the meeting details. Here's the high-level sequence.
In Addon: OnReady() -> onReadyHandler() -> context.getUser() -> context.getMeeting()
The change I made to get it to work was to remove the final step and call it, more deliberately from the consuming app:
In Addon: OnReady() -> onReadyHandler() -> context.getUser()
In my addon, I have an accessor function for the meeting details call, like this:
ADDON CODE:
_cachedMeetingPromise: undefined; get meeting(): Promise<any>{ let retVal = this._cachedMeetingPromise ? this._cachedMeetingPromise : this.localDev ? Promise.resolve(this.fakedMeetingInfo) : this.context.getMeeting(); this._cachedMeetingPromise = retVal; retVal.then((meetingInfo: any)=>{ this.currentRoles = meetingInfo.userRoles; this._cachedMeetingPromise = undefined; console.log("WEBEX for getMeetings: ", meetingInfo) }).catch((error:any) =>{ this._cachedMeetingPromise = undefined; // @ts-ignore console.log("WEBEX ERROR for getMeetings: ", Webex.Application.ErrorCodes[error]) }) return retVal; }
Which I then call in the consuming app like this:
APP CODE: this.webex.meeting.then((meeting: any)=>{ this.websocket.connect(meeting); }).catch((error)=>{ console.log("WEBEX IN APP: ERROR FOR GET MEETING", error); })
This seems to be working now. I suppose it's possible that the sequencing and timing between calls could have caused an issue.
04-04-2022 03:17 PM
Hi @chshipma , thanks for your question! Would you add the platform (Mac/Win) and client version of Webex where you're experiencing this?
Some things to check for in general:
Thanks for adding additional info for us on this.
04-04-2022 03:23 PM
Thanks for the reply, I modified my original post to contain the extra version information.
Further, I decided to deploy the kitchen sink app in my dev account and I can mash the "getMeeting()" button and get information back about the meeting every time.
04-05-2022 10:12 AM
Thanks for these details @chshipma ! One more question: does your code wait for `onReady()` to resolve before attempting to access methods and properties?
04-05-2022 12:35 PM - edited 04-05-2022 12:36 PM
So, I sorted out my issue, but I'm not sure why it worked. here's the code context.
I am using EmberJS to develop my embedded app. To aid in this, I've made an EmberJS Addon (found here, it's still a WIP) which essentially wraps the Embedded App SDK with Ember conventions to enable some data-binding in the templating engine.
When my app boots up, it initializes the addon, which in turn creates an instance of the SDK.
In ADDON:
this._webexInstance = new window.Webex.Application();
...which I then immediately setup the promise chain to respond to the onReady() event:
In ADDON:
this._webexInstance.onReady().then(() => { })
Once the instance reports that it's ready, I then go and fetch the user. Once the user is resolved, I then resolve the promise that was blocking my app from booting.
It was here that I was then calling "getMeeting()" to get the meeting details. Here's the high-level sequence.
In Addon: OnReady() -> onReadyHandler() -> context.getUser() -> context.getMeeting()
The change I made to get it to work was to remove the final step and call it, more deliberately from the consuming app:
In Addon: OnReady() -> onReadyHandler() -> context.getUser()
In my addon, I have an accessor function for the meeting details call, like this:
ADDON CODE:
_cachedMeetingPromise: undefined; get meeting(): Promise<any>{ let retVal = this._cachedMeetingPromise ? this._cachedMeetingPromise : this.localDev ? Promise.resolve(this.fakedMeetingInfo) : this.context.getMeeting(); this._cachedMeetingPromise = retVal; retVal.then((meetingInfo: any)=>{ this.currentRoles = meetingInfo.userRoles; this._cachedMeetingPromise = undefined; console.log("WEBEX for getMeetings: ", meetingInfo) }).catch((error:any) =>{ this._cachedMeetingPromise = undefined; // @ts-ignore console.log("WEBEX ERROR for getMeetings: ", Webex.Application.ErrorCodes[error]) }) return retVal; }
Which I then call in the consuming app like this:
APP CODE: this.webex.meeting.then((meeting: any)=>{ this.websocket.connect(meeting); }).catch((error)=>{ console.log("WEBEX IN APP: ERROR FOR GET MEETING", error); })
This seems to be working now. I suppose it's possible that the sequencing and timing between calls could have caused an issue.
04-04-2022 03:37 PM
Hi Chuck, which specific code is returned for the rejected promise? Here are the error code descriptions if this helps.
04-04-2022 05:36 PM
It’s returning undefined.
04-05-2022 05:51 AM
Tested this with just a button that calls a getMeeting function and it correctly returned.
Button in HTML file.
<button onclick="getMeeting()">Get Meeting</button>
Function in the JS file.
function getMeeting() { app.context.getMeeting().then((m) => { console.log('getMeeting()', m); }).catch((error) => { console.log('getMeeting() promise failed with error', Webex.Application.ErrorCodes[error]); }); }
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide