-
Notifications
You must be signed in to change notification settings - Fork 56
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
Get preferences on Mattermost 6.2 #275
Comments
I try to run on a docker environment, beforeEach(() => {
tested = new Client(
MATTERMOST_PREVIEW_SERVER_URL,
MATTERMOST_PREVIEW_SERVER_GROUP,
MATTERMOST_PREVIEW_SERVER_OPTIONS);
});
describe('Mattermost integration tests ...', () => {
test('should login with credentials', async () => {
let loginResult = tested.login(MATTERMOST_USERNAME, MATTERMOST_PASSWORD, null);
await new Promise((r) => setTimeout(r, 4000));
log.info('loginResult', loginResult);
});
}); But everything seems to be ok :
We can see, all status code to 200 and no errors. The project |
@VincentSC Any additionnal informations before closing ? |
Seems best to first focus on the node red library, and reopen this issue if needed. I'll be working on it later this month |
Looked further into it. I cannot find out why it happens. In MM 6.4 it even gets worse and a reconnect does not work anymore. But there is a simple solution. I do see that self.preferences` is not used anywhere - it is even not instantiated in the constructor. So the call can be fully removed - or is it WIP-code? |
I don't know if the code is WIP or not. I will inspect it and if useless I will update it |
Thanks! It is about the variable mattermost-client/src/client.js Line 176 in 2d57570
I don't see being used anywhere, including hubot If important, then it needs to be correctly initiated in the constructor. If not important for logging in, it would be very convenient for me to be removed. Let me know if I can do something for you. |
I have check and double check, there are no change on preferences API which can explain your problem. The possible issue can be on the Mattermost instance you use. What I can do is avoid In the latests versions we have improve logging. It could be interesting to have the debug log for your case. Anyway, I will improve error handling on preferences. |
Got docker and can switch between 6.1, 6.2, 6.3 and 6.4 in half a minute. So without making any other change, all works fine when reverting to 6.1 and stops working when I go to a newer one. I neither see any API-change and it makes no sense to me either, so that it got worse in 6.4 makes no sense to me. It looks like that the connection drops quicker and reconnect does not work as intended. So I don't think it has to do with the call, but that there are multiple calls in a row. I have not tested, but I won't be surprised it will work when I call it manually after the login-succeeded. Latest version is on NPM? I will then update the dependency in the nodered-plugin, so I can test. And did you remove the getPreferences in that new version? If not, then I know I might need to patch it here. |
This is what I do for this answer #275 (comment) If you have a docker-compose I will test to reproduce. if the current code version fix the problem @loafoe will produce a release asap for npm. |
Ok, after lot of test, it seems that calling I will fix it ASAP. |
Ah, I thought the Thanks for the effort! |
… client Transfert the hubot logger to mattermost-client refs loafoe/mattermost-client#275
Transfert the hubot logger to mattermost-client refs loafoe/mattermost-client#275
fix(client): #275 fix preferences error management
fix(matteruser): loafoe/mattermost-client#275 fix logger transfert to…
I have tested it and it works |
For some reason the library stops working on Mattermost 6.2.
Line 113 in
/mattermost-client/src/client.js
:causes an
Error: WebSocket was closed before the connection was established
.For all functions, when data is null, there is the possibility of an uncaught exception. This means there needs to be a check if data is null in all functions. The above error I get when I fix this for
_onPeferences
.See https://gitlab.com/benoit.lavorata/node-red-contrib-mattermost-ws/-/issues/9 for more info - that nodejs package depends on 6.1.2, but 6.4.1 also has the problem.
I'm not understanding exactly how this library works, and I don't know where to start to fix this. :(
I also tried the latest 8.2.x version of Mattermost, but they all have the unexpected closing of the the socket.
But I did find a fix, based on an assumption that there might be a security fix that closes the connection in some situations. PR coming up soon.
The text was updated successfully, but these errors were encountered: