OpenVidu / openvidu

OpenVidu Platform main repository

Home Page:https://openvidu.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[2.18.0] Unwanted logger requests

alecpl opened this issue · comments

I upgraded from 2.16 to 2.18 and I notice something that didn't happen before.

It's been revealed by another issue that throws session connection error. After that happens I get a request to /jsnlog.logger url every few seconds, and it does not stop. The response is error 405, as I have no backend for this request set up.

  1. How to configure the logger to not send any requests? It look that they are being sent also in prod mode.
  2. There seems to be a bug, the request should not be send so often.

Tested with latest Firefox. Both server (your docker image) and browser in version 2.18. I'm using the free version.

Update: Here's some info on how it gets to the described issue. I have such a pseudo-code:

session.on('connectionCreated', event => {
    session.signal({... to: connection ...});
    if (screenSession) screenSession.signal({... to: connection ... });
});

The second .signal() call fails because the screenSession is not fully set up yet (screenSession.connection=null) and the error is not catched. Note that this code didn't throw errors in 2.16 so there's some race-condition introduced, I guess. Anyway, this leads to the jsnlog request which is repeated every 5-6 seconds.

Hello @alecpl

First of all, thank you for reporting with such details.

In version 2.18.0 we've added a library in openvidu-browser called jsnlog to send logs produced by the library to have browser side visibility on errors (only in PRO version to the configured ElasticSearch, only if configured).

What we did not notice until your report is that this library is actually overriding 2 window functions to catch errors: https://github.com/mperdeck/jsnlog.js/blob/master/jsnlog.js#L982-L1012

I've digged around to the MDN documentation about those functions and there is a workaround to solve those jsnlog annoying requests. You need to put somewhere in the main entry point of your frontend app this code:

window.onerror = () => { return false };
window.onunhandledrejection = () => { return false };

This will override the function added by jsnlog and by returning false, the error will propagate and be catched by the browser as it would normally do.

We will fix this issue on the next release. Please give me feedback if this workaround works for you.

About the .signal() error, if it still happens after this workaround, please open another issue.

Regards

We will fix this issue on the next release. Please give me feedback if this workaround works for you.

I confirm the workaround works. Thanks.

About the .signal() error, if it still happens after this workaround, please open another issue.

This is indeed a separate issue thanks to which I found this one. I'll create a separate ticket although I've found some workarounds.

After upgrading to 2.18.0, we also found that if there was a page error, we would received the request of /jsnlog.logger every few seconds,That is, new OpenVidu() is not called
Try to use the code, but it doesn't work

window.onerror = () => { return false };
window.onunhandledrejection = () => { return false };

Did you put this code in the main entrypoint of your frontend application?

Sorry, the commit closed this issue. I'll close this if we decide to launch a 2.18.1 openvidu-browser patch, or when 2.19.0 is released.

Technically, it is fixed in master branch and here: https://github.com/OpenVidu/openvidu/tree/v2.18.x

We've released a 2.18.1 version in npm of openvidu-browser. I'll close this issue. Please confirm @alecpl @wujingacross that this works for you.

Best Regards