internxt / drive-desktop

https://internxt.com/drive
GNU Affero General Public License v3.0
168 stars 21 forks source link

[_]:(fix) Connect correctly to notifications websocket #275

Closed PixoDev closed 1 year ago

PixoDev commented 1 year ago

Fix how we connect to notifications websocket, tested on local

JoanVicens commented 1 year ago

I'm not seeing the new token change you mention. Also, not sure about the transport change I think I talked about it with @sg-gs but not remember if we wanted to avoid the WebSocket

PixoDev commented 1 year ago

So after investigating for a bit why the polling is failing, I noticed that the handler in the notifications server is waiting for a X-API-KEY header, since we are not sending it, because that endpoint is used for requesting notifications to send messages, and not to receive the messages itself, polling won't work right now:

https://github.com/internxt/notifications/blob/master/src/auth-api-middleware.ts

This is what happens when I try to connect to my local notifications from desktop, even with Postman

https://gyazo.com/4bc7aad0dd6d42455adf3fa27b702665

Even setting the X-API-KEY header in the request, it will fail because we are missing body (we get a 400), because we cannot connect to that endpoint to get notifications from, so right now only websocket transport will work

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication