The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
migrate(docs): troubleshooting 29 (#30950)
Charis000cabd1ddc0
diff --git a/apps/docs/content/troubleshooting/pgcron-debugging-guide-n1KTaz.mdx b/apps/docs/content/troubleshooting/pgcron-debugging-guide-n1KTaz.mdxnew file mode 100644index 00000000000..cb812a28ef8--- /dev/null+++ b/apps/docs/content/troubleshooting/pgcron-debugging-guide-n1KTaz.mdx@@ -0,0 +1,198 @@+---+title = "pg_cron debugging guide"+github_url = "https://github.com/orgs/supabase/discussions/30168"+date_created = "2024-10-29T15:12:11+00:00"+topics = ["database"]+keywords = ["pg_cron", "cron", "jobs", "scheduler", "debugging"]+---++This is a general guide for debugging pg_cron. Below lists issues and how to debug them++# Cannot create/edit/delete cron jobs++Cron jobs can only be modified with the respective SQL functions:++- Schedule: [cron.schedule](https://supabase.com/docs/guides/database/extensions/pg_cron#delete-data-every-week)+- Alter: [cron.alter_job](https://supabase.com/docs/guides/database/extensions/pg_cron#edit-a-job)+- Delete: [cron.unschedule](https://supabase.com/docs/guides/database/extensions/pg_cron#unschedule-a-job)++If you are trying to make changes, please use the cron functions. If the cron functions are inaccessible, please contact [Support](https://supabase.com/dashboard/support/new)++<br />++---++# Cron Jobs are not running++> You should consider initiating a software upgrade in the [Infrastructure Settings](https://supabase.com/dashboard/project/_/settings/infrastructure) if your Postgres version is below v15.6.1.122. Upgrading will give you access to pg_cron v1.6.4+, which has many bug fixes and auto-revive capabilities.++## Debugging steps:++### Check to see if "pg_cron scheduler" is active++pg_cron operates as the `pg_cron scheduler` process within Postgres. Use the below query to check if the worker is active++```sql+SELECT+ pid as process_id,+ usename as database_user,+ application_name,+ backend_start as when_process_began,+ wait_event_type,+ state,+ query,+ backend_type+FROM pg_stat_activity where application_name ilike 'pg_cron scheduler';+```++If the query does not return a row, the worker has died. To revive it, you must go to the [General Settings](https://supabase.com/dashboard/project/_/settings/general) and initiate a fast reboot:++<img+ width="719"+ alt="Screenshot 2024-10-29 at 12 27 24 AM"+ src="https://github.com/user-attachments/assets/d7a2956c-08e0-4ebc-be08-d14a2383f36b"+/>++<br />++### Check the `cron.job_run_details` table for more information++pg_cron creates logs in its own table `cron.job_run_details"`. The below query checks for issues from the past 5 days :++```sql+SELECT *+FROM cron.job_run_details+WHERE+ (status <> 'succeeded' AND status <> 'running')+ AND+ start_time > NOW() - INTERVAL '5 days'+ORDER BY start_time DESC+LIMIT 10;+```++Respond to the errors exposed appropriately.++> Long running jobs may show timeout errors. For jobs that are intended to execute for extended periods, consider wrapping their queries in functions with custom timeouts ([guide](https://supabase.com/docs/guides/database/postgres/timeouts#function-level)).++<br />++### Check if there are too many cron jobs running concurrently++pg_cron supports up to 32 concurrent jobs, each using a database connection. If too many jobs are running simultaneously, space them out to prevent connection overload and job failure.++The below queries shows all pg_cron jobs:++```sql+-- All jobs+select schedule, jobname, command from cron.job;++-- Count jobs+select COUNT(*) from cron.job;+```++The below query can be used to find actively querying jobs:++```sql+SELECT+ pid as process_id,+ usename as database_user,+ application_name,+ backend_start as when_process_began,+ wait_event_type,+ state,+ query,+ backend_type+FROM pg_stat_activity where application_name ilike 'pg_cron';+```++You can view your peak connection usage throughout the day at the bottom of the [Reports Dashboard](https://supabase.com/dashboard/project/_/reports/database)++<br />++### Check for database strain++Unfortunately, excessive resource strain can slow down or disrupt jobs.++Go to the [reports page](https://supabase.com/dashboard/project/_/reports/database) (or [Supabase Grafana](https://supabase.com/docs/guides/monitoring-troubleshooting/metrics#deploying-supabase-grafana) if you have it setup), and check for signs of resource exhaustion. If it's clear your database is under pressure, consider upgrading your compute add-on or following the advice from one of the optimization guides:++- [Connections](https://github.com/orgs/supabase/discussions/27141)+- [Disk/IO](https://github.com/orgs/supabase/discussions/27003)+- [Memory](https://github.com/orgs/supabase/discussions/27021)+- [CPU](https://github.com/orgs/supabase/discussions/27022)++It is important to make sure you are running the latest release of pg_cron (1.6.4) if you're noticing strain. It is the most robust.++<br />++### Check the Log explorer for more information++Although pg*cron records errors in the `cron.job_run_details` table, in rare cases, more information can be found in the general Postgres logs. You can check the [Log Explorer](https://supabase.com/dashboard/project/*/logs/explorer) for failure events with the following query++```sql+select+ cast(postgres_logs.timestamp as datetime) as timestamp,+ event_message,+ parsed.error_severity,+ parsed.user_name,+ parsed.query,+ parsed.detail,+ parsed.hint,+ parsed.sql_state_code,+ parsed.backend_type,+ parsed.application_name+from+ postgres_logs+ cross join unnest(metadata) as metadata+ cross join unnest(metadata.parsed) as parsed+where+ regexp_contains(parsed.error_severity, 'ERROR|FATAL|PANIC')+ and regexp_contains(parsed.application_name, 'pg_cron')+order by timestamp desc+limit 100;+```++If you're interested in modifying the query, there is an advanced [guide](https://github.com/orgs/supabase/discussions/26224) for navigating the postgres logs and a general purpose [one](https://supabase.com/docs/guides/platform/advanced-log-filtering) for applying filters.++<br />++### Create custom logs within cron jobs++If it's still not clear what is occurring you may be able to capture more logs by running the pg_cron query inside a database function:++```sql+create or replace function log_example()+returns void+language plpgsql+as $$+begin++ -- Logging start of function+ raise log 'logging start of cron function call: (%)', (select now());++ -- INSERT LOGIC HERE++ -- Logging end of function+ raise log 'logging end of cron function call: (%)', (select now());++ exception+ -- Handle exceptions here if needed+ when others then+ raise exception 'An error occurred in cron function <insert name here>. ERROR MESSAGE: %', sqlerrm;++end;+$$;+```++You can then search for your custom messages in the [Logs Interface](https://supabase.com/dashboard/project/_/logs/postgres-logs)++<br />++### Upgrading pg_cron version++The current version of pg*cron on Supabase is 1.6.4. It comes with a [few bug fixes](https://github.com/citusdata/pg_cron/releases/tag/v1.6.4). You should consider upgrading to postgres v15.6.1.122+ in the[ Infrastructure Settings](https://supabase.com/dashboard/project/*/settings/infrastructure) to get the latest extension.++<br />++### Contacting Support and the maintainers++Although Supabase includes the extension, it is maintained by Citus (a Microsoft subsidiary). You can contact Support for more help, but you should also consider creating an issue in the [pg_cron repo](https://github.com/citusdata/pg_cron).diff --git a/apps/docs/content/troubleshooting/resolving-database-hostname-and-managing-your-ip-address-pVlwE0.mdx b/apps/docs/content/troubleshooting/resolving-database-hostname-and-managing-your-ip-address-pVlwE0.mdxnew file mode 100644index 00000000000..8cc50383596--- /dev/null+++ b/apps/docs/content/troubleshooting/resolving-database-hostname-and-managing-your-ip-address-pVlwE0.mdx@@ -0,0 +1,38 @@+---+title = "Resolving database hostname and managing your IP address"+github_url = "https://github.com/orgs/supabase/discussions/22400"+date_created = "2024-04-02T09:01:54+00:00"+topics = ["database"]+keywords = ["hostname", "ip", "ipv4", "ipv6"]+---++### Finding Your Database Hostname++Your database's hostname is crucial for establishing a direct connection. It resolves to the underlying IP address of your database. To find your hostname, navigate to your [Database Settings](https://supabase.com/dashboard/project/_/settings/database). It's important to note that the pooler (connection pooler) has a different IP than your database. Therefore, to reveal the database host and direct connection string, you must hide the pooler connection string.++Example Hostname: `db.zcjtzmeifsoteyjytnbc.supabase.co`++++### Managing Your IP Address++To determine your current IP address, you can use an [IP address lookup](https://whatismyipaddress.com/hostname-ip) website or the terminal command:++- Type `nslookup hostname` and press Enter.+- This command queries the domain name servers to find the IP address of the given hostname.++Example IPv6 Address: `2a05:d014:1c06:5f0c:d7a9:8616:bee2:30df`++### IPv6 Address++Upon project creation, a static IPv6 address is assigned. However, it's essential to understand that this IPv6 address can change due to specific actions:++- When a project is paused or resumed.+- During database version upgrades.++### IPv4 Address++Opting for the static [IPv4 addon](https://supabase.com/docs/guides/platform/ipv4-address) provides a more stable connection address. The IPv4 address remains constant unless:++- The project is paused or resumed.+- Unlike the IPv6 address, upgrading your database does not affect the IPv4 address.diff --git a/apps/docs/content/troubleshooting/supabase--your-network-ipv4-and-ipv6-compatibility-cHe3BP.mdx b/apps/docs/content/troubleshooting/supabase--your-network-ipv4-and-ipv6-compatibility-cHe3BP.mdxnew file mode 100644index 00000000000..64637bd1174--- /dev/null+++ b/apps/docs/content/troubleshooting/supabase--your-network-ipv4-and-ipv6-compatibility-cHe3BP.mdx@@ -0,0 +1,82 @@+---+title = "Supabase & Your Network: IPv4 and IPv6 compatibility"+github_url = "https://github.com/orgs/supabase/discussions/27034"+date_created = "2024-06-05T16:26:47+00:00"+topics = ["database", "platform", "supavisor"]+keywords = ["ipv4", "ipv6", "network", "compatibility", "address"]+---++# Network Compatibility with your Supabase Database++The internet uses a system called the Internet Protocol (IP) to route communication between devices. There are two main versions:++- **IPv4**: Introduced in 1980, it's the original version.+- **IPv6**: Launched in 1999, it offers a much larger address space and is the preferred future-proof option.++### Supabase and IPv6:++All Supabase databases provide a direct connection string that maps to an IPv6 address.++### Working with IPv6 Incompatible Hosts:++Here are your options if your server platform doesn't support IPv6:++- Use the Supavisor Connection String (available in the [Dashboard](https://supabase.com/dashboard/project/_/settings/database)).+- Use the [Supabase Client libraries](https://supabase.com/docs/guides/api/rest/client-libs), which are IPv4 compatible.+- Enable the [dedicated IPv4 Add-On](https://supabase.com/dashboard/project/_/settings/addons) (available to Pro and above orgs)++> Note: the IPv4 Add-On costs $0.0055 an hour, which equates to ~$4.00 if left on for a full month (~720 hours)++### Checking IPv6 Support:++The majority of services are IPv6 compatible. However, there are a few prominent ones that only accept IPv4 connections:++- [Retool](https://retool.com/)+- [Vercel](https://vercel.com/)+- [GitHub Actions](https://docs.github.com/en/actions)+- [Render](https://render.com/)++If you're still unsure if your network supports IPv6, you can run this cURL command on your deployment server:++```sh+curl -6 https://ifconfig.co/ip+```++If the command returns an IPv6 address, the network is IPv6 compatible.++### Finding your Database's IP Address:++To determine your current IP address, you can use an IP address [lookup website](https://whatismyipaddress.com/hostname-ip) or the terminal command:++```sh+nslookup db.<PROJECT_REF>.supabase.co+```++This command queries the domain name servers to find the IP address of the given hostname.++Example IPv6 Address: `2a05:d014:1c06:5f0c:d7a9:8616:bee2:30df`++### Identifying your connections:++The pooler and direct connection strings can be found in the [database settings](https://supabase.com/dashboard/project/_/settings/database):++> "Note uses an IPv6 address by default++```sh+# Example connection string+postgresql://postgres:[YOUR-PASSWORD]@db.ajrbwkcuthywfihaarmflo.supabase.co:5432/postgres+```++#### Supavisor in transaction mode (port 6543)++```sh+# Example transaction string+postgresql://postgres.ajrbwkcuthywddfihrmflo:[YOUR-PASSWORD]@aws-0-us-east-1.pooler.supabase.com:6543/postgres+```++#### Supavisor in session mode (port 5432)++```sh+# Example session string+postgresql://postgres.ajrbwkcuthywfddihrmflo:[YOUR-PASSWORD]@aws-0-us-east-1.pooler.supabase.com:5432/postgres+```diff --git a/apps/docs/content/troubleshooting/upload-file-size-restrictions-Y4wQLT.mdx b/apps/docs/content/troubleshooting/upload-file-size-restrictions-Y4wQLT.mdxnew file mode 100644index 00000000000..b611844c724--- /dev/null+++ b/apps/docs/content/troubleshooting/upload-file-size-restrictions-Y4wQLT.mdx@@ -0,0 +1,41 @@+---+title = "Upload file size restrictions"+github_url = "https://github.com/orgs/supabase/discussions/27431"+date_created = "2024-06-20T23:15:48+00:00"+topics = ["storage"]+keywords = ["upload", "file", "size", "restriction"]+---++You can view the max permissible upload size for your plan in the [docs](https://supabase.com/docs/guides/storage/uploads/file-limits).++## There are two ways to control the max upload sizes:++The first way is through the [global storage settings](https://supabase.com/dashboard/project/_/settings/storage):++<img+ width="920"+ alt="Screenshot 2024-06-20 at 7 06 57 PM"+ src="https://github.com/supabase/supabase/assets/91111415/c33acc4a-efd8-4746-ac98-ddc71e17f8f1"+/>++The second way is at the [bucket level](https://supabase.com/dashboard/project/_/storage/buckets/)++1. Edit a bucket's configurations:++ <img+ width="355"+ alt="Screenshot 2024-06-20 at 7 07 48 PM"+ src="https://github.com/supabase/supabase/assets/91111415/51719d9f-3644-40ed-9aaa-8b21fff41634"+ />++2. Change the file upload restriction if set:+ <img+ width="340"+ alt="Screenshot 2024-06-20 at 7 07 56 PM"+ src="https://github.com/supabase/supabase/assets/91111415/917f3cf6-81c4-444f-9ac1-f26eec5eac0c"+ />++## Different upload methods impose file size restrictions:++- [Standard uploads can only transfer up to 5GBs](https://supabase.com/docs/guides/storage/uploads/standard-uploads?queryGroups=language&language=js). However, for files above 6MB, the below methods are more performant and reliable+- [Resumable](https://supabase.com/docs/guides/storage/uploads/resumable-uploads) and [S3](https://supabase.com/docs/guides/storage/uploads/resumable-uploads) uploads can support transfers up to 50GB in size.diff --git a/apps/docs/content/troubleshooting/webhook-debugging-guide-M8sk47.mdx b/apps/docs/content/troubleshooting/webhook-debugging-guide-M8sk47.mdxnew file mode 100644index 00000000000..6d4ea1b841a--- /dev/null+++ b/apps/docs/content/troubleshooting/webhook-debugging-guide-M8sk47.mdx@@ -0,0 +1,87 @@+---+title = "Webhook debugging guide"+github_url = "https://github.com/orgs/supabase/discussions/21023"+date_created = "2024-02-05T17:56:07+00:00"+topics = ["database"]+keywords = ["webhook", "timeout", "pg_net", "postgres", "trigger"]+---++> NOTE: version 0.10.0 of pg*net is out. You should consider updating your database in the[ Infrastructure Settings](https://supabase.com/dashboard/project/*/settings/infrastructure) if you are on a prior version. If you do not know your version, you can check the [Extensions Dashboard](https://supabase.com/dashboard/project/_/database/extensions).++**Debugging Steps**++**1. Test if webhooks are active:**+Webhooks are run in a Postgresql background worker. The first debugging step is to see if the worker is active. Run the following SQL code:++```sql+select pid from pg_stat_activity where backend_type ilike '%pg_net%';+```++If it does not return an integer, then the worker has failed and needs to be restarted. If you are running PG_NET 0.8 or later, you can restart the background worker by executing the following function:++```sql+select net.worker_restart();+```++Otherwise, it is necessary to fast reboot your instance in the [Dashboard's Settings](https://supabase.com/dashboard/project/_/settings/general).++**2. Remove any triggers on net tables:**++Using `pg_net` in triggers on most tables is fine; however, please do not add triggers to the `net._http_response` or `net.http_request_queue` tables.++The `net` tables are special and if triggers on them fail or call a pg_net function (`http_get`, `http_post`, `http_delete`), it can lead to an infinite loop. This warning is irrelevant to most projects, but it's worth specifying just in case.++**3. Check for timeout errors**++> **NOTE**: The timeout issue has been patched in pg*net v0.11. It is available in Postgres 15.6.1.135 and above. You can upgrade your version of Postgres in the [Infrastructure Settings.](https://supabase.com/dashboard/project/*/settings/infrastructure)++Go to your [Table Editor](https://supabase.com/dashboard/project/_/editor/) and navigate to the net schema. It will contain two tables:++- `_http_response`+- `http_request_queue`++The `_http_response` table saves all the response messages from the past 6 hours. If every column contains NULL values, except for the `id`, `error_msg`, and `created` columns, then you are experiencing [a timeout bug](https://github.com/supabase/pg_net/issues/86).++By default, webhooks will execute the next 200 available queued requests. If the requests are too intense, it may result in a mass timeout. In the [Webhook Dashboard](https://supabase.com/dashboard/project/_/database/hooks), you should increase your webhook's timeout to minimize this issue.++**4. Inspect endpoints**+The below code makes a request to the Postman Echo API through PG_NET++```sql+select+net.http_post(+url := 'https://postman-echo.com/post',+body := '{"key1": "value", "key2": 5}'::jsonb+) as request_id;+```++Postman will then respond with the same payload. This is just a test to confirm that requests are being properly formatted and going through.++You can then view the request in the `net._http_response table` in the [Table Editor](https://supabase.com/dashboard/project/_/editor) or with the following SQL:++```sql+select+*+from net._http_response+where id = <request_id>+```++You should also inspect all the failed responses from the past 6 hours to see if their are any insightful messages:++```sql+select+ *+from net._http_response+where "status_code" >= 400 or "error_msg" is not null+order by created desc;+```++Status codes from a server are described in [Mozilla's web docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)++**5. Create logs**++If none of the above suggestions uncovered the cause of the error, for debugging purposes, it may be useful to write a custom webhook that can create logs in the [Dashboard's Postgres Logs](https://supabase.com/dashboard/project/_/logs/postgres-logs). The process is outlined in the [PG_NET](https://supabase.com/docs/guides/database/extensions/pg_net#debugging-requests) documentation.++**Conclusion:**++If your issue still persists, please document it as an issue in the [PG_NET Github Repo](https://github.com/supabase/pg_net/issues). You are also welcome to contact Supabase Support from your project's [Dashboard](https://supabase.com/dashboard/project/_/) for more guidance.diff --git a/apps/docs/content/troubleshooting/why-cant-i-uploadlistetc-my-public-bucket-Z6CmGt.mdx b/apps/docs/content/troubleshooting/why-cant-i-uploadlistetc-my-public-bucket-Z6CmGt.mdxnew file mode 100644index 00000000000..6a1b744ca59--- /dev/null+++ b/apps/docs/content/troubleshooting/why-cant-i-uploadlistetc-my-public-bucket-Z6CmGt.mdx@@ -0,0 +1,10 @@+---+title = "Why can't I upload/list/etc my public bucket?"+github_url = "https://github.com/orgs/supabase/discussions/19180"+date_created = "2023-11-23T16:52:55+00:00"+topics = ["storage"]+---++A public bucket in the storage API only means there is a public URL available you can use to download the file.+All other bucket or file operations require you to meet storage policies on that bucket.+Note also you should use the normal path for all other operations and not the public URL path with 'public' in it.diff --git a/apps/docs/public/img/troubleshooting/565c96e0-cbb9-4e7a-b0aa-5b423afc0ada.png b/apps/docs/public/img/troubleshooting/565c96e0-cbb9-4e7a-b0aa-5b423afc0ada.pngnew file mode 100644index 00000000000..2b0270cbfefBinary files /dev/null and b/apps/docs/public/img/troubleshooting/565c96e0-cbb9-4e7a-b0aa-5b423afc0ada.png differ