ConnectionTimeout.tsx47 lines · main
1import { TroubleshootingAccordion } from '../TroubleshootingAccordion'
2import {
3 FixWithAITroubleshootingSection,
4 RestartDatabaseTroubleshootingSection,
5 TroubleshootingGuideSection,
6} from '../TroubleshootingSections'
7import { SIDEBAR_KEYS } from '@/components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'
8import { useAiAssistantStateSnapshot } from '@/state/ai-assistant-state'
9import { useSidebarManagerSnapshot } from '@/state/sidebar-manager-state'
10
11const ERROR_TYPE = 'connection-timeout'
12
13const BUILD_PROMPT = () =>
14 `The user is encountering connection timeout errors. The error message is: "CONNECTION TERMINATED DUE TO CONNECTION TIMEOUT". What are the most likely causes of this issue and how can the user resolve it?`
15
16export function ConnectionTimeoutTroubleshooting() {
17 const { openSidebar } = useSidebarManagerSnapshot()
18 const aiSnap = useAiAssistantStateSnapshot()
19
20 return (
21 <TroubleshootingAccordion
22 errorType={ERROR_TYPE}
23 stepTitles={{
24 1: 'Try restarting your project',
25 2: 'Try our troubleshooting guide',
26 3: 'Debug with AI',
27 }}
28 >
29 <RestartDatabaseTroubleshootingSection number={1} errorType={ERROR_TYPE} />
30 <TroubleshootingGuideSection
31 number={2}
32 errorType={ERROR_TYPE}
33 href="https://supabase.com/docs/guides/troubleshooting/failed-to-run-sql-query-connection-terminated-due-to-connection-timeout"
34 description="Follow step-by-step instructions for diagnosing connection timeout issues."
35 />
36 <FixWithAITroubleshootingSection
37 number={3}
38 errorType={ERROR_TYPE}
39 onDebugWithAI={(prompt) => {
40 openSidebar(SIDEBAR_KEYS.AI_ASSISTANT)
41 aiSnap.newChat({ initialMessage: prompt })
42 }}
43 buildPrompt={BUILD_PROMPT}
44 />
45 </TroubleshootingAccordion>
46 )
47}