The situation is as follows: my code has the following:
// login a user with their auth token
const chat = document.getElementById('rc_chat') as HTMLIFrameElement;
chat?.contentWindow?.postMessage(
{
externalCommand: 'login-with-token',
token: token
},
'*'
);
chat.src = chat.src; //refreshing the iframe
However this isn’t working and all I see is a gray screen in the iframe:
But when I execute that code from the browser console (developer tools), then the user is logged in. So why is my code not working?
I just noticed the following error when my code runs, but again running the code from the console works:
TypeError: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type undefined
at f (170eae3306caaff00de1cbf5a55650f41f14726f.js?meteor_js_resource=true:655)
at Function.s.from (170eae3306caaff00de1cbf5a55650f41f14726f.js?meteor_js_resource=true:655)
at a.publicKeyFromString (170eae3306caaff00de1cbf5a55650f41f14726f.js?meteor_js_resource=true:997)
at a.setServerKey (170eae3306caaff00de1cbf5a55650f41f14726f.js?meteor_js_resource=true:997)
at async l (170eae3306caaff00de1cbf5a55650f41f14726f.js?meteor_js_resource=true:997)
These are the network calls when I open the iframe:
Well it worked on my localhost and I deployed the fix to dev however it’s not working on dev and now it’s not working on localhost either. I still receive the gray screen. Any idea what the issue is? I’d be happy to show it via video call so let me know if any time works for you
I have figured the issue out. To whom it may concern:
I was loading RC within a popup and once the popup was opening, then I was executing the login command or change room command. I think the login/page change commands were being issued before RC could load in the popup which contained the iFrame.
Yes I am aware… read some of the links in the gist above, specifically these which will help you ask question which you are more likely to get answers for:
“Tell us about the problem you were originally trying to solve, not the problem that you are experiencing right now.
Frequently the one you are experiencing now is the result of not understanding or being able to fix the original issue”
Always give a clear concise description - we cannot see your screen or read your mind!