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

Backend throws error during notification attempt if no websocket connection #146

Open
1 task done
tyler-dane opened this issue Oct 3, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@tyler-dane
Copy link
Contributor

tyler-dane commented Oct 3, 2024

Prerequisites

  • Using an up-to-date main branch

Expected Behavior

Given that the backend has a notification from google about an event change
And the user with the change is not currently connected to compass via websockets
Then the backend should not attempt to emit the update to the user's client
And the backend should not throw and error

Current Behavior

Backend throws and logs error.

74|backend | 400 POST /api/sync/gcal/notifications 265.820ms Thu, 03 Oct 2024 15:42:06 GMT

74|backend  | 24-10-03 15:55:08 [debug] app:sync.service.helpers: updating: "💸 Some Event"  | xyz
74|backend  | 24-10-03 15:55:08 [warn] app:websocket.server: Event update not sent to client due to missing userId: some-user-id
74|backend  | 24-10-03 15:55:08 [error] app:sync.controller: Not sure how to handle this error:
74|backend  | 24-10-03 15:55:08 [error] app:sync.controller: Invalid socket id {
74|backend  |   "result": "Event update not sent to client",
74|backend  |   "description": "Invalid socket id",
74|backend  |   "statusCode": 400,
74|backend  |   "isOperational": true,
74|backend  |   "stack": "Error: Invalid socket id\n    at new BaseError (/compass/packages/core/src/errors/errors.base.ts:23:11)\n    at error (/compass/packages/backend/src/common/errors/handlers/error.handler.ts:9:10)\n    at notifyClient (/compass/packages/backend/src/servers/websocket/websocket.server.ts:34:16)\n    at SyncService.<anonymous> (/compass/packages/backend/src/sync/services/sync.service.ts:97:17)\n    at Generator.next (<anonymous>)\n    at fulfilled (/compass/build/node/node_modules/tslib/tslib.js:166:62)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)"
74|backend  | }

Steps to Reproduce

  1. Close any browser windows with connection to Compass app

  2. Make change in Google cal

  3. See compass backend logs

Possible Solution (Not obligatory)

Instead of throwing error in this scenario, just log a debug message

Context

This doesn't affect users directly. It's more of a dev inconvenience, because now the logs show errors during normal behavior

@tyler-dane tyler-dane added the bug Something isn't working label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant