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

[FIX] Cannot read property 'debug' of undefined when trying to use REST API #10805

Merged
merged 3 commits into from
Jun 4, 2018
Merged

Conversation

haffla
Copy link
Contributor

@haffla haffla commented May 17, 2018

Fixes #10581 (I don't know why it was closed)

I am not sure why logger was defined twice - once as an instance outside of the class and once as a field of the class using this. This PR cleans this up a little by removing the latter. I believe it is obvious why this.logger is undefined since it is called inside of function _internalRouteActionHandler() { ... } which creates a new scope where this is something else.

To be honest - and I am very sorry for that - I did not test this but I tried for two hours to get Rocket.Chat running on my machine to no avail (and I am no JS noob), neither the develop branch nor any of the recent releases, different errors all over the place. I followed the developer section in the Readme.

Also the test suit npm run test doesn't work, so I am really sorry for that.

What I don't understand is why this has not been crashing for everyone?!?!

Edit: I was able to test this now 👍

@CLAassistant
Copy link

CLAassistant commented May 17, 2018

CLA assistant check
All committers have signed the CLA.

@haffla
Copy link
Contributor Author

haffla commented May 19, 2018

Updating to latest seems to fix the problem. Feel free to close this. Though I think this PR still has a point.

EDIT: Nope, it's crashing again... this seems to be very non-deterministic, nasty bug

@engelgabriel engelgabriel added this to the 0.66.0 milestone Jun 4, 2018
@rodrigok
Copy link
Member

rodrigok commented Jun 4, 2018

Hi @haffla we just found a race condition where the api endpoint is registered before the declaration of this.logger at the constructor, that cause the issue.

Your PR solves that issue, we will merge it and complement with another fix.

Thanks

@rodrigok rodrigok changed the title [FIX] Clean up usage of logger, prevent logger being undefined [FIX] Cannot read property 'debug' of undefined when trying to use REST API Jun 4, 2018
@rodrigok rodrigok merged commit c24ac1c into RocketChat:develop Jun 4, 2018
@rodrigok rodrigok mentioned this pull request Jun 28, 2018
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

Successfully merging this pull request may close these issues.

Rocket Chat Rest Api Login error (Server error.)
4 participants