mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## 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).
24 lines
929 B
TypeScript
24 lines
929 B
TypeScript
import { ConnectionTimeoutError, SupavisorSessionPoolError } from '@/lib/errors/studio-errors'
|
|
import type { ClassifiedError, StudioErrorInput } from '@/lib/errors/studio-errors'
|
|
|
|
type ErrorConstructor = new (input: StudioErrorInput) => ClassifiedError
|
|
|
|
export interface ErrorPattern {
|
|
pattern: RegExp
|
|
ErrorClass: ErrorConstructor
|
|
}
|
|
|
|
/**
|
|
* Maps each error class to its matching regex pattern.
|
|
* Using a Map guarantees each class can only appear once — duplicates are
|
|
* impossible by construction rather than only caught by tests.
|
|
*/
|
|
const ERROR_PATTERN_MAP = new Map<ErrorConstructor, RegExp>([
|
|
[ConnectionTimeoutError, /CONNECTION\s+TERMINATED\s+DUE\s+TO\s+CONNECTION\s+TIMEOUT/i],
|
|
[SupavisorSessionPoolError, /MaxClientsInSessionMode:\s*max clients reached/i],
|
|
])
|
|
|
|
export const ERROR_PATTERNS: ErrorPattern[] = Array.from(ERROR_PATTERN_MAP.entries()).map(
|
|
([ErrorClass, pattern]) => ({ ErrorClass, pattern })
|
|
)
|