ConnectionTimeout.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { TroubleshootingAccordion } from '../TroubleshootingAccordion'
  2. import {
  3. FixWithAITroubleshootingSection,
  4. RestartDatabaseTroubleshootingSection,
  5. TroubleshootingGuideSection,
  6. } from '../TroubleshootingSections'
  7. import { SIDEBAR_KEYS } from '@/components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'
  8. import { useAiAssistantStateSnapshot } from '@/state/ai-assistant-state'
  9. import { useSidebarManagerSnapshot } from '@/state/sidebar-manager-state'
  10. const ERROR_TYPE = 'connection-timeout'
  11. const BUILD_PROMPT = () =>
  12. `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?`
  13. export function ConnectionTimeoutTroubleshooting() {
  14. const { openSidebar } = useSidebarManagerSnapshot()
  15. const aiSnap = useAiAssistantStateSnapshot()
  16. return (
  17. <TroubleshootingAccordion
  18. errorType={ERROR_TYPE}
  19. stepTitles={{
  20. 1: 'Try restarting your project',
  21. 2: 'Try our troubleshooting guide',
  22. 3: 'Debug with AI',
  23. }}
  24. >
  25. <RestartDatabaseTroubleshootingSection number={1} errorType={ERROR_TYPE} />
  26. <TroubleshootingGuideSection
  27. number={2}
  28. errorType={ERROR_TYPE}
  29. href="https://supabase.com/docs/guides/troubleshooting/failed-to-run-sql-query-connection-terminated-due-to-connection-timeout"
  30. description="Follow step-by-step instructions for diagnosing connection timeout issues."
  31. />
  32. <FixWithAITroubleshootingSection
  33. number={3}
  34. errorType={ERROR_TYPE}
  35. onDebugWithAI={(prompt) => {
  36. openSidebar(SIDEBAR_KEYS.AI_ASSISTANT)
  37. aiSnap.newChat({ initialMessage: prompt })
  38. }}
  39. buildPrompt={BUILD_PROMPT}
  40. />
  41. </TroubleshootingAccordion>
  42. )
  43. }