Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RocketChat /home randomly not loaded when embedded in iFrame #22125

Closed
dmitri-vlasov opened this issue May 24, 2021 · 4 comments
Closed

RocketChat /home randomly not loaded when embedded in iFrame #22125

dmitri-vlasov opened this issue May 24, 2021 · 4 comments

Comments

@dmitri-vlasov
Copy link

dmitri-vlasov commented May 24, 2021

Description:

RocketChat embedded in iFrame and sometimes it is stuck on three dots animation for very long time. After reloading a page it loads ok.
Login is performed in my case with API which sets token right in Mongo: user['services']['iframe'] = {'token': token}.
Values of "Accounts_iframe_url" and "Accounts_Iframe_api_url" are set, iframe integration enabled:

// enabling iframe inegration in RocketChat
db.rocketchat_settings.updateOne({"_id" : "Accounts_iframe_enabled"}, {$set: {value: true}})
db.rocketchat_settings.updateOne({"_id" : "Accounts_iframe_url"}, {
    $set: {value: "/login/?next=/rocketchat_redirect/",
           meteorSettingsValue: "/login/?next=/rocketchat_redirect/"}
})
db.rocketchat_settings.updateOne({"_id" : "Accounts_Iframe_api_url"}, {
    $set: {value: "/rocketchat_api/",
           meteorSettingsValue: "/rocketchat_api/"}
})

I see the same error in console in both browsers I've used to test - Google Chrome and Safari:

Error: No callback invoker for method 4

Steps to reproduce:

  1. Embed RocketChat in iFrame with <iframe id="rcChannel" name="rcChannel" src="/home"></iframe>
  2. Enable iframe integration is RocketChat and set correct API values for "Accounts_iframe_url" and "Accounts_Iframe_api_url"
  3. Load a page in browser
  4. You will see sometimes 3 dots loading animation stucks for forever and error in console: Error: No callback invoker for method 4

Expected behavior:

Load RocketChat alway without errors in console.

Actual behavior:

3 dots loading animation stucks for forever and error in console: Error: No callback invoker for method 4.

See error in Safari
Error in Safari

and error in Chrome

Error in Chrome

Server Setup Information:

  • Version of Rocket.Chat Server: 3.13.2
  • Operating System: Debian GNU/Linux 10 (buster)
  • Deployment Method: snap
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 12.21.0 - x64
  • MongoDB Version: 3.6.14

Client Setup Information

  • Desktop App or Browser Version: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Safari/605.1.15 and Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
  • Operating System: Debian GNU/Linux 10 (buster)

Additional context

Formatted JS file where console log points to (taken from Safari). Line 430 is the anonymous function which generates an error.
13da2367791c877b19ed3b477f50333556da3853.js.txt

Relevant logs:

maybe these logs are related to the bug:

May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: [Method] registerLoginHandler
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: Exception while invoking method login Error: Unrecognized options for login request [400]
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at AccountsServer._runLoginHandlers (packages/accounts-base/accounts_server.js:513:14)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at AccountsServer.Accounts._runLoginHandlers (app/lib/server/lib/loginErrorMessageOverride.js:7:35)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at MethodInvocation.methods.login (packages/accounts-base/accounts_server.js:557:31)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1771:12)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at packages/ddp-server/livedata_server.js:1689:15
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at packages/ddp-server/livedata_server.js:1687:36
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at new Promise ()
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Server.applyAsync (packages/ddp-server/livedata_server.js:1686:12)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Server.apply (packages/ddp-server/livedata_server.js:1625:26)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Server.call (packages/ddp-server/livedata_server.js:1607:17)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Object.post (app/api/server/v1/misc.js:263:26)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at app/api/server/api.js:394:82
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Object._internalRouteActionHandler [as action] (app/api/server/api.js:394:39)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Route.share.Route.Route._callEndpoint (packages/nimble_restivus/lib/route.coffee:150:32)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at packages/nimble_restivus/lib/route.coffee:59:33
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at packages/simple_json-routes.js:98:9
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: => awaited here:
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Promise.await (/snap/rocketchat-server/1459/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:60:12)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Server.apply (packages/ddp-server/livedata_server.js:1638:22)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Server.call (packages/ddp-server/livedata_server.js:1607:17)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Object.post (app/api/server/v1/misc.js:263:26)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at app/api/server/api.js:394:82
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Object._internalRouteActionHandler [as action] (app/api/server/api.js:394:39)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at Route.share.Route.Route._callEndpoint (packages/nimble_restivus/lib/route.coffee:150:32)
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at packages/nimble_restivus/lib/route.coffee:59:33
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: at packages/simple_json-routes.js:98:9
May 23 21:12:29 production rocketchat-server.rocketchat-server[2013]: [Method] registerLoginHandler

@johncrisp
Copy link

Hi and thanks for reporting this.

First, have you tested this with the latest - either 3.14 or preferably 3.15 RC ?

Second, are you running in a subdirectory? I just saw the /home reference? I just wanted to check.

@dmitri-vlasov
Copy link
Author

Hi @johncrisp,

thanks for your reply.

First, have you tested this with the latest - either 3.14 or preferably 3.15 RC ?

Not yet, but will do now. How I pull a concrete version using snaps? Or it's just for building for source?

Second, are you running in a subdirectory? I just saw the /home reference? I just wanted to check.

No, it's not a subdirectory. RC is behind Nginx. /home is the RocketChat's home router endpoint (home page). The Nginx config is:

server {
   server_name # server name here

   location / {
       proxy_pass http://0.0.0.0:3000;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header Host $host;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

       # WebSocket support
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
   }
  
   listen [::]:443 ssl ipv6only=on; # managed by Certbot
   listen 443 ssl; # managed by Certbot
   # Certificates here
}

@dmitri-vlasov
Copy link
Author

dmitri-vlasov commented May 29, 2021

Hi @johncrisp,

I've manually installed version 3.14 according this guide and everything seems. works now! This bug disappeared.

I would say thank you for your advice and I will close the issue now.

@LouisSung
Copy link

LouisSung commented Jun 30, 2021

Hi,
Thank you for reporting this : )
We also met this error in our on-premise server with native Electron app (customized based on Rocket.Chat.Electron@3.2.2) when the first time logged in
It's reproducible on my PC but not the others..., that makes it even harder to find out the root cause...

I'm not quite sure how Electron render the Rocket.Chat page (using <webview> ?) and still troubleshooting the whole stack, but let me keep track on this issue first _(:3

BTW, our Rocket.Chat was based on 3.15.0, although we customize some of the code without touching the core (at least things related to Meteor)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants