Files
supabase/apps/studio/components/interfaces/ErrorHandling/error-mappings.tsx
Jordi Enric c2edb29076 fix(studio): explain Supavisor session pool limits DEBUG-43 (#53930)
## Problem

When Supavisor rejects a session because its connection pool is full,
Studio shows the error without explaining how to recover.

## Fix

Show a troubleshooting step for the session-mode limit that explains how
pool size limits concurrent clients and links to the configuration
guide.

## Screenshot

The Table Editor’s troubleshooting step, rendered locally with a sample
session-pool error.

<img width="660" alt="Expanded Supavisor session pool limit guidance in
the Table Editor"
src="https://github.com/user-attachments/assets/6072eec4-e243-4d53-a40f-30fb14d21d05"
/>

## How to test

- Display a classified MaxClientsInSessionMode error in Studio and
expand its troubleshooting step. The link should open the pool size
section of the database connection management guide.
- Display a generic transaction-mode connection limit error. It should
keep its usual fallback.
- The pattern, classification and ErrorMatcher suites exercise these
paths (144 tests passed locally).

Fixes [DEBUG-43](https://linear.app/supabase/issue/DEBUG-43).
2026-11-30 16:49:05 +01:00

28 lines
1.0 KiB
TypeScript

import { ComponentType } from 'react'
import { ConnectionTimeoutTroubleshooting } from './errorMappings/ConnectionTimeout'
import { SupavisorSessionPoolTroubleshooting } from './errorMappings/SupavisorSessionPool'
import { ConnectionTimeoutError, SupavisorSessionPoolError } from '@/lib/errors/studio-errors'
import type { ClassifiedError, StudioErrorInput } from '@/lib/errors/studio-errors'
/** Mapping ID, also sent as `errorType` in troubleshooter telemetry. */
type ErrorMappingId = 'connection-timeout' | 'supavisor-session-pool'
export interface ErrorMapping {
id: ErrorMappingId
Troubleshooting: ComponentType
}
type ErrorConstructor = new (input: StudioErrorInput) => ClassifiedError
export const ERROR_MAPPINGS = new Map<ErrorConstructor, ErrorMapping>([
[
ConnectionTimeoutError,
{ id: 'connection-timeout', Troubleshooting: ConnectionTimeoutTroubleshooting },
],
[
SupavisorSessionPoolError,
{ id: 'supavisor-session-pool', Troubleshooting: SupavisorSessionPoolTroubleshooting },
],
])