Skip to content

403 Rate Limit Exceeded after changing event in google calendar #335

Description

@tyler-dane

Where did this happen?

Staging environment

Expected Behavior

Rarely should a Compass user encounter any error due to a rate limit

If they do, we should give them an indication that we're working on it and that their data will be synced shortly

Current Behavior

 |       "error": {
87|backend  |         "errors": [
87|backend  |           {
87|backend  |             "domain": "usageLimits",
87|backend  |             "reason": "rateLimitExceeded",
87|backend  |             "message": "Rate Limit Exceeded"
87|backend  |           }
87|backend  |         ],
87|backend  |         "code": 403,
87|backend  |         "message": "Rate Limit Exceeded"
87|backend  |       }
87|backend  |     },
87|backend  |     "headers": {
87|backend  |       "cache-control": "no-cache, no-store, max-age=0, must-revalidate",
87|backend  |       "connection": "close",
87|backend  |       "content-encoding": "gzip",
87|backend  |       "content-type": "application/json; charset=UTF-8",
87|backend  |       "date": "Mon, 31 Mar 2025 11:20:19 GMT",
87|backend  |       "expires": "Mon, 01 Jan 1990 00:00:00 GMT",
87|backend  |       "pragma": "no-cache",
87|backend  |       "server": "ESF",
87|backend  |       "transfer-encoding": "chunked",
87|backend  |       "vary": "Origin, X-Origin, Referer",
87|backend  |       "x-content-type-options": "nosniff",
87|backend  |       "x-frame-options": "SAMEORIGIN",
87|backend  |       "x-l2-request-path": "l2-managed-14",
87|backend  |       "x-xss-protection": "0"
87|backend  |     },
87|backend  |     "status": 403,
87|backend  |     "statusText": "Forbidden",
87|backend  |     "request": {
87|backend  |       "responseURL": "https://www.googleapis.com/calendar/v3/calendars/primary/events/e5srrkr361upjc2be22u6ti4pe_20250406T120000Z"
87|backend  |     }
87|backend  |   },
87|backend  |   "config": {
87|backend  |     "url": "https://www.googleapis.com/calendar/v3/calendars/primary/events/e5srrrr161upjc2be22u6ti444_20250406T120000Z",
87|backend  |     "method": "PATCH",
87|backend  |     "userAgentDirectives": [
87|backend  |       {
87|backend  |         "product": "google-api-nodejs-client",
87|backend  |         "version": "6.0.4",
87|backend  |         "comment": "gzip"
87|backend  |       }
87|backend  |     ],
87|backend  |     "data": {

Steps to Reproduce

  1. Signup using a calendar with lots of events
  2. Make a change in Google calendar
  3. Sync notification triggered
  4. Check backend logs for 403 Rate limit exceeded error
  5. If no error, delete user and start-over. Re-signing up will trigger a bunch of new API calls during the import. If you keep doing this in a short time, you should encounter this

Possible Solution

Prevent error

  • If possible, limit how many API calls we're making during the initial import

Handle error

  • Implement exponential backoff

Context

Related to #540

This might only be an issue during local development, as it's very unlikely that a user will delete their account (revoke access to Compass) and re-signup in a short timeframe

https://developers.google.com/calendar/api/guides/errors#403_rate_limit_exceeded

https://developers.google.com/calendar/api/guides/errors#exponential-backoff

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendWork related to improving the Compass APIneeds more infoNot ready for coding just yet

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions