https://sonarly.com/issue/33071?type=bug
`checkCalendarAvailability` only catches `failedPrecondition` (HTTP 400) errors but Google also returns HTTP 403 with "The user must be signed up for Google Calendar." for accounts without Calendar provisioned. This unhandled 403 bubbles up as an uncaught error to Sentry and shows a confusing error redirect to the user.
Fix: Extended `isServiceNotEnabledError()` in `GoogleApisServiceAvailabilityService` to handle HTTP 403 errors where Google returns "The user must be signed up for Google Calendar." (or similar "must be signed up" messages for any Google service).
**What changed:**
1. **`google-apis-service-availability.service.ts`**: The `isServiceNotEnabledError` method now also checks for HTTP 403 responses with error messages containing "must be signed up". Previously it only handled HTTP 400 `failedPrecondition` errors. The fix:
- Extracts the HTTP status code from `error.response.status` (previously only `error.response.data.error` was used)
- After checking the existing `failedPrecondition` conditions, adds a second check: if the response status is 403 AND the error message contains "must be signed up", the error is classified as service-not-enabled
- Renamed `gmailError` → `googleError` since this method handles both Gmail and Calendar errors
2. **`google-apis-service-availability.service.spec.ts`**: Added a test case that simulates the exact error from the Sentry event — a 403 response with `reason: 'notACalendarUser'` and message "The user must be signed up for Google Calendar." — and verifies that `checkServicesAvailability` returns `isCalendarAvailable: false` instead of throwing.
**Why this approach:**
- Follows the same pattern as the previous fix (commit e7f958c9cf) which extended the error classifier
- The condition `isForbidden && isNotSignedUp` is specific enough to avoid false positives (requires both 403 status AND "must be signed up" in the message)
- The fix handles the error at the right layer — the availability check returns `false`, allowing the OAuth flow to continue with Gmail-only integration (or show a proper error if neither service is available)
**Monitoring impact:**
By catching this error in `isServiceNotEnabledError`, it no longer propagates as a raw GaxiosError to the controller's catch block, which means `GuardRedirectService.captureException()` is never called for this error. This eliminates the Sentry noise without any separate monitoring code changes.
The #1 Open-Source CRM
Website ·
Documentation ·
Roadmap ·
Discord ·
Figma
Why Twenty
Twenty gives technical teams the building blocks for a custom CRM that meets complex business needs and quickly adapts as the business evolves. Twenty is the CRM you build, ship, and version like the rest of your stack.
Learn more about why we built Twenty
Installation
Cloud
The fastest way to get started. Sign up at twenty.com and spin up a workspace in under a minute, with no infrastructure to manage and always up to date.
Build an app
Scaffold a new app with the Twenty CLI:
npx create-twenty-app my-app
Define objects, fields, and views as code:
import { defineObject, FieldType } from 'twenty-sdk/define';
export default defineObject({
nameSingular: 'deal',
namePlural: 'deals',
labelSingular: 'Deal',
labelPlural: 'Deals',
fields: [
{ name: 'name', label: 'Name', type: FieldType.TEXT },
{ name: 'amount', label: 'Amount', type: FieldType.CURRENCY },
{ name: 'closeDate', label: 'Close Date', type: FieldType.DATE_TIME },
],
});
Then ship it to your workspace:
npx twenty deploy
See the app development guide for objects, views, agents, and logic functions.
Self-hosting
Run Twenty on your own infrastructure with Docker Compose, or contribute locally via the local setup guide.
Everything you need
Twenty gives you the building blocks of a modern CRM (objects, views, workflows, and agents) and lets you extend them as code. Here's a tour of what's in the box.
Want to go deeper? Read the User Guide for product walkthroughs, or the
Documentation for developer reference.
|
|
|
|
|
|
Stack
TypeScript
Nx
NestJS, with BullMQ,
PostgreSQL,
Redis
React, with Jotai, Linaria and Lingui
Thanks
Thanks to these amazing services that we use and recommend for UI testing (Chromatic), code review (Greptile), catching bugs (Sentry) and translating (Crowdin).
Join the Community
Star the repo ·
Discord ·
Feature requests ·
Releases ·
X ·
LinkedIn ·
Crowdin ·
Contribute





