The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs(realtime error codes) (#36891)
Charisf107437ae0f9
diff --git a/apps/docs/content/errorCodes/authErrorCodes.toml b/apps/docs/content/errorCodes/authErrorCodes.tomlindex 837a8564320..8d33253b3e0 100644--- a/apps/docs/content/errorCodes/authErrorCodes.toml+++ b/apps/docs/content/errorCodes/authErrorCodes.toml@@ -4,6 +4,7 @@## [error_code]# description = "Error description."+# resolution = "How to resolve this error."# [[error_code.references]]# href = "https://supabase.com/docs/some/relevant/guide"# description = "Guide for doing some relevant thing"diff --git a/apps/docs/content/errorCodes/realtimeErrorCodes.toml b/apps/docs/content/errorCodes/realtimeErrorCodes.tomlnew file mode 100644index 00000000000..d594f4f1da8--- /dev/null+++ b/apps/docs/content/errorCodes/realtimeErrorCodes.toml@@ -0,0 +1,211 @@+# Official error codes for Supabase Realtime+#+# Error codes should be documented in the following format+#+# [error_code]+# description = "Error description."+# resolution = "How to resolve this error."+# [[error_code.references]]+# href = "https://supabase.com/docs/some/relevant/guide"+# description = "Guide for doing some relevant thing"+#+# error_code should be a unique and stable identifier for the error, that the+# developer can match against for error handling.++[TopicNameRequired]+description = "You are trying to use Realtime without a topic name set."++[RealtimeDisabledForConfiguration]+description = "The configuration provided to Realtime on connect will not be able to provide you any Postgres Changes."+resolution = "Verify your configuration on channel startup as you might not have your tables properly registered."++[TenantNotFound]+description = "The tenant you are trying to connect to does not exist."+resolution = "Verify the tenant name you are trying to connect to exists in the realtime.tenants table."++[ErrorConnectingToWebsocket]+description = "Error when trying to connect to the WebSocket server."+resolution = "Verify user information on connect."++[ErrorAuthorizingWebsocket]+description = "Error when trying to authorize the WebSocket connection."+resolution = "Verify user information on connect."++[TableHasSpacesInName]+description = "The table you are trying to listen to has spaces in its name which we are unable to support."+resolution = "Change the table name to not have spaces in it."++[UnableToDeleteTenant]+description = "Error when trying to delete a tenant."++[UnableToSetPolicies]+description = "Error when setting up Authorization Policies."++[UnableCheckoutConnection]+description = "Error when trying to checkout a connection from the tenant pool."++[UnableToSubscribeToPostgres]+description = "Error when trying to subscribe to Postgres changes."++[ReconnectSubscribeToPostgres]+description = "Postgres changes still waiting to be subscribed."++[ChannelRateLimitReached]+description = "The number of channels you can create has reached its limit."++[ConnectionRateLimitReached]+description = "The number of connected clients has reached its limit."++[ClientJoinRateLimitReached]+description = "The rate of joins per second from your clients has reached the channel limits."++[RealtimeDisabledForTenant]+description = "Realtime has been disabled for the tenant."++[UnableToConnectToTenantDatabase]+description = "Realtime was not able to connect to the tenant's database."++[DatabaseLackOfConnections]+description = "Realtime was not able to connect to the tenant's database due to not having enough available connections."+resolution = "Verify your database connection limits."+[[DatabaseLackOfConnections.references]]+href = "https://supabase.com/docs/guides/database/connection-management"+description = "Connection management guide"++[RealtimeNodeDisconnected]+description = "Realtime is a distributed application and this means that one the system is unable to communicate with one of the distributed nodes."++[MigrationsFailedToRun]+description = "Error when running the migrations against the Tenant database that are required by Realtime."++[StartListenAndReplicationFailed]+description = "Error when starting the replication and listening of errors for database broadcasting."++[ReplicationMaxWalSendersReached]+description = "Maximum number of WAL senders reached in tenant database."+[[ReplicationMaxWalSendersReached.references]]+href = "https://supabase.com/docs/guides/database/custom-postgres-config#cli-configurable-settings"+description = "Configuring max WAL senders"++[MigrationCheckFailed]+description = "Check to see if we require to run migrations fails."++[PartitionCreationFailed]+description = "Error when creating partitions for realtime.messages."++[ErrorStartingPostgresCDCStream]+description = "Error when starting the Postgres CDC stream which is used for Postgres Changes."++[UnknownDataProcessed]+description = "An unknown data type was processed by the Realtime system."++[ErrorStartingPostgresCDC]+description = "Error when starting the Postgres CDC extension which is used for Postgres Changes."++[ReplicationSlotBeingUsed]+description = "The replication slot is being used by another transaction."++[PoolingReplicationPreparationError]+description = "Error when preparing the replication slot."++[PoolingReplicationError]+description = "Error when pooling the replication slot."++[SubscriptionDeletionFailed]+description = "Error when trying to delete a subscription for postgres changes."++[UnableToDeletePhantomSubscriptions]+description = "Error when trying to delete subscriptions that are no longer being used."++[UnableToCheckProcessesOnRemoteNode]+description = "Error when trying to check the processes on a remote node."++[UnableToCreateCounter]+description = "Error when trying to create a counter to track rate limits for a tenant."++[UnableToIncrementCounter]+description = "Error when trying to increment a counter to track rate limits for a tenant."++[UnableToDecrementCounter]+description = "Error when trying to decrement a counter to track rate limits for a tenant."++[UnableToUpdateCounter]+description = "Error when trying to update a counter to track rate limits for a tenant."++[UnableToFindCounter]+description = "Error when trying to find a counter to track rate limits for a tenant."++[UnhandledProcessMessage]+description = "Unhandled message received by a Realtime process."++[UnableToTrackPresence]+description = "Error when handling track presence for this socket."++[UnknownPresenceEvent]+description = "Presence event type not recognized by service."++[IncreaseConnectionPool]+description = "The number of connections you have set for Realtime are not enough to handle your current use case."++[RlsPolicyError]+description = "Error on RLS policy used for authorization."++[ConnectionInitializing]+description = "Database is initializing connection."++[DatabaseConnectionIssue]+description = "Database had connection issues and connection was not able to be established."++[UnableToConnectToProject]+description = "Unable to connect to Project database."++[InvalidJWTExpiration]+description = "JWT exp claim value it's incorrect."++[JwtSignatureError]+description = "JWT signature was not able to be validated."++[MalformedJWT]+description = "Token received does not comply with the JWT format."++[Unauthorized]+description = "Unauthorized access to Realtime channel."++[RealtimeRestarting]+description = "Realtime is currently restarting."++[UnableToProcessListenPayload]+description = "Payload sent in NOTIFY operation was JSON parsable."++[UnableToListenToTenantDatabase]+description = "Unable to LISTEN for notifications against the Tenant Database."++[UnprocessableEntity]+description = "Received a HTTP request with a body that was not able to be processed by the endpoint."++[InitializingProjectConnection]+description = "Connection against Tenant database is still starting."++[TimeoutOnRpcCall]+description = "RPC request within the Realtime server has timed out."++[ErrorOnRpcCall]+description = "Error when calling another realtime node."++[ErrorExecutingTransaction]+description = "Error executing a database transaction in tenant database."++[SynInitializationError]+description = "Our framework to syncronize processes has failed to properly startup a connection to the database."++[JanitorFailedToDeleteOldMessages]+description = "Scheduled task for realtime.message cleanup was unable to run."++[UnableToEncodeJson]+description = "An error were we are not handling correctly the response to be sent to the end user."++[UnknownErrorOnController]+description = "An error we are not handling correctly was triggered on a controller."++[UnknownErrorOnChannel]+description = "An error we are not handling correctly was triggered on a channel."diff --git a/apps/docs/content/guides/auth/debugging/error-codes.mdx b/apps/docs/content/guides/auth/debugging/error-codes.mdxindex b24e8741eb6..43dd3a762d2 100644--- a/apps/docs/content/guides/auth/debugging/error-codes.mdx+++ b/apps/docs/content/guides/auth/debugging/error-codes.mdx@@ -105,7 +105,7 @@ Sent out when a feature is not enabled on the Auth server, and you are trying toThe following table provides a comprehensive list of error codes you may encounter when working with Supabase Auth. Each error code is associated with a specific issue and includes a description to help you understand and resolve the problem efficiently.-<AuthErrorCodes />+<ErrorCodes service="auth" />## Best practices for error handlingdiff --git a/apps/docs/content/guides/realtime/error_codes.mdx b/apps/docs/content/guides/realtime/error_codes.mdxindex cfbc3b93528..69a999b8ee6 100644--- a/apps/docs/content/guides/realtime/error_codes.mdx+++ b/apps/docs/content/guides/realtime/error_codes.mdx@@ -1,40 +1,6 @@---title: 'Operational Error Codes'subtitle: 'List of operational codes to help understand your deployment and usage.'-description: ''----| Code | Description | Action |-| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |-| `RealtimeDisabledForConfiguration` | The configuration provided to Realtime on connect will not be able to provide you any Postgres Changes | Verify your configuration on channel startup as you might not have your tables properly registered |-| `TenantNotFound` | The tenant you are trying to connect to does not exist | Verify the tenant name you are trying to connect to exists in the realtime.tenants table |-| `ErrorConnectingToWebSocket` | Error when trying to connect to the WebSocket server | Verify user information on connect |-| `ErrorAuthorizingWebSocket` | Error when trying to authorize the WebSocket connection | Verify user information on connect |-| `TableHasSpacesInName` | The table you are trying to listen to has spaces in its name which we are unable to support | Change the table name to not have spaces in it |-| `UnableToDeleteTenant` | Error when trying to delete a tenant | Contact Support |-| `UnableToSetPolicies` | Error when setting up Authorization Policies | Contact Support |-| `UnableCheckoutConnection` | Error when trying to checkout a connection from the tenant pool | Contact Support |-| `UnableToSubscribeToPostgres` | Error when trying to subscribe to Postgres changes | Contact Support |-| `ChannelRateLimitReached` | The number of channels you can create has reached its limit | Contact support to increase your rate limits |-| `ConnectionRateLimitReached` | The number of connected clients as reached its limit | Contact support to increase your rate limits |-| `ClientJoinRateLimitReached` | The rate of joins per second from your clients as reached the channel limits | Contact support to increase your rate limits |-| `UnableToConnectToTenantDatabase` | Realtime was not able to connect to the tenant's database | Contact support for further instructions |-| `DatabaseLackOfConnections` | Realtime was not able to connect to the tenant's database due to not having enough available connections | Verify your database connection limits. For more information refer to [Connection Management guide](/docs/guides/database/connection-management) |-| `RealtimeNodeDisconnected` | Realtime is a distributed application and this means that one the system is unable to communicate with one of the distributed nodes | Contact support for further instructions |-| `MigrationsFailedToRun` | Error when running the migrations against the Tenant database that are required by Realtime | Contact support for further instructions |-| `ErrorStartingPostgresCDCStream` | Error when starting the Postgres CDC stream which is used for Postgres Changes | Contact support for further instructions |-| `UnknownDataProcessed` | An unknown data type was processed by the Realtime system | Contact support for further instructions |-| `ErrorStartingPostgresCDC` | Error when starting the Postgres CDC extension which is used for Postgres Changes | Contact support for further instructions |-| `ReplicationSlotBeingUsed` | The replication slot is being used by another transaction | Contact support for further instructions |-| `PoolingReplicationPreparationError` | Error when preparing the replication slot | Contact support for further instructions |-| `PoolingReplicationError` | Error when pooling the replication slot | Contact support for further instructions |-| `SubscriptionDeletionFailed` | Error when trying to delete a subscription for Postgres changes | Contact support for further instructions |-| `UnableToDeletePhantomSubscriptions` | Error when trying to delete subscriptions that are no longer being used | Contact support for further instructions |-| `UnableToCheckProcessesOnRemoteNode` | Error when trying to check the processes on a remote node | Contact support for further instructions |-| `UnableToCreateCounter` | Error when trying to create a counter to track rate limits for a tenant | Contact support for further instructions |-| `UnableToIncrementCounter` | Error when trying to increment a counter to track rate limits for a tenant | Contact support for further instructions |-| `UnableToDecrementCounter` | Error when trying to decrement a counter to track rate limits for a tenant | Contact support for further instructions |-| `UnableToUpdateCounter` | Error when trying to update a counter to track rate limits for a tenant | Contact support for further instructions |-| `UnableToFindCounter` | Error when trying to find a counter to track rate limits for a tenant | Contact support for further instructions |-| `UnhandledProcessMessage` | Unhandled message received by a Realtime process | Contact support for further instructions |-| `UnknownError` | An unknown error occurred | Contact support for further instructions |+<ErrorCodes service="realtime" />diff --git a/apps/docs/features/docs/MdxBase.shared.tsx b/apps/docs/features/docs/MdxBase.shared.tsxindex 2cd48285bb4..7a5bb363be1 100644--- a/apps/docs/features/docs/MdxBase.shared.tsx+++ b/apps/docs/features/docs/MdxBase.shared.tsx@@ -28,14 +28,13 @@ import { CodeBlock } from '~/features/ui/CodeBlock/CodeBlock'import InfoTooltip from '~/features/ui/InfoTooltip'import { ShowUntil } from '~/features/ui/ShowUntil'import { TabPanel, Tabs } from '~/features/ui/Tabs'-import { AuthErrorCodes } from '../ui/AuthErrorCodes'+import { ErrorCodes } from '../ui/ErrorCodes'const components = {Accordion,AccordionItem,Admonition,AiPromptsIndex,- AuthErrorCodes,AuthSmsProviderConfig,AppleSecretGenerator,AuthProviders,@@ -44,6 +43,7 @@ const components = {CodeSampleDummy,CodeSampleWrapper,CostWarning,+ ErrorCodes,Extensions,GlassPanel,IconArrowDown: ArrowDown,diff --git a/apps/docs/features/ui/AuthErrorCodes.tsx b/apps/docs/features/ui/ErrorCodes.tsxsimilarity index 62%rename from apps/docs/features/ui/AuthErrorCodes.tsxrename to apps/docs/features/ui/ErrorCodes.tsxindex 35ffeff249b..ea9fa98022a 100644--- a/apps/docs/features/ui/AuthErrorCodes.tsx+++ b/apps/docs/features/ui/ErrorCodes.tsx@@ -1,17 +1,28 @@import Link from 'next/link'import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from 'ui'-import _errorCodes from '~/content/errorCodes/authErrorCodes.toml'+import _authErrorCodes from '~/content/errorCodes/authErrorCodes.toml'+import _realtimeErrorCodes from '~/content/errorCodes/realtimeErrorCodes.toml'import { type ErrorCodeDefinition } from '~/resources/error/errorTypes'-const errorCodes: Record<string, ErrorCodeDefinition> = _errorCodes+const errorCodesByService = {+ auth: _authErrorCodes as Record<string, ErrorCodeDefinition>,+ realtime: _realtimeErrorCodes as Record<string, ErrorCodeDefinition>,+}++interface ErrorCodesProps {+ service: keyof typeof errorCodesByService+}-export function AuthErrorCodes() {+export function ErrorCodes({ service }: ErrorCodesProps) {+ const errorCodes = errorCodesByService[service]+ const hasResolutions = Object.values(errorCodes).some((code) => code.resolution)return (<Table><TableHeader><TableRow><TableHead>Error code</TableHead><TableHead>Description</TableHead>+ {hasResolutions && <TableHead>Action</TableHead>}</TableRow></TableHeader><TableBody>@@ -37,6 +48,9 @@ export function AuthErrorCodes() {</>)}</TableCell>+ {hasResolutions && (+ <TableCell>{!!definition.resolution && <p>{definition.resolution}</p>}</TableCell>+ )}</TableRow>))}</TableBody>diff --git a/apps/docs/resources/error/errorSync.ts b/apps/docs/resources/error/errorSync.tsindex 55c0f25649d..7ca729de860 100644--- a/apps/docs/resources/error/errorSync.ts+++ b/apps/docs/resources/error/errorSync.ts@@ -52,7 +52,10 @@ async function doFetchErrorCodes(}async function fetchErrorCodes(): Promise<Result<Array<ErrorCodeUploadParameters>, MultiError>> {- const arrayOfResults = await Promise.all([doFetchErrorCodes('authErrorCodes.toml', Service.Auth)])+ const arrayOfResults = await Promise.all([+ doFetchErrorCodes('authErrorCodes.toml', Service.Auth),+ doFetchErrorCodes('realtimeErrorCodes.toml', Service.Realtime),+ ])return Result.transposeArray(arrayOfResults).map((result) => result.flat())}diff --git a/apps/docs/resources/error/errorTypes.ts b/apps/docs/resources/error/errorTypes.tsindex 5c02889073e..64b8858c373 100644--- a/apps/docs/resources/error/errorTypes.ts+++ b/apps/docs/resources/error/errorTypes.ts@@ -1,4 +1,5 @@export interface ErrorCodeDefinition {description: string+ resolution?: stringreferences?: Array<{ href: string; description: string }>}