The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs: key changes for troubleshooting docs (#44937)
Chris Chinchilla2eab2d6cdc30
diff --git a/apps/docs/content/troubleshooting/auth-error-401-invalid-claim-missing-sub--AFwMR.mdx b/apps/docs/content/troubleshooting/auth-error-401-invalid-claim-missing-sub--AFwMR.mdxindex e7277102b49..7e886563426 100644--- a/apps/docs/content/troubleshooting/auth-error-401-invalid-claim-missing-sub--AFwMR.mdx+++ b/apps/docs/content/troubleshooting/auth-error-401-invalid-claim-missing-sub--AFwMR.mdx@@ -20,7 +20,7 @@ message = "invalid claim: missing sub"The missing sub claim error is returned when `supabase.auth.getUser()` is called with an invalid JWT in the session or when the user attempts to register/sign in but hasn't completed the sign in when the `getUser` call is made.-A common pitfall, is inadvertently using a Supabase API key (such as the anon or service_role keys) instead of the Supabase Auth access token.+A common pitfall, is inadvertently using a Supabase API key (such as the publishable or secret keys) instead of the Supabase Auth access token.**Why Does This Happen?**diff --git a/apps/docs/content/troubleshooting/grafana-not-displaying-data-sXJrMj.mdx b/apps/docs/content/troubleshooting/grafana-not-displaying-data-sXJrMj.mdxindex 62feed8679d..3d2571b9e93 100644--- a/apps/docs/content/troubleshooting/grafana-not-displaying-data-sXJrMj.mdx+++ b/apps/docs/content/troubleshooting/grafana-not-displaying-data-sXJrMj.mdx@@ -14,7 +14,7 @@ This guide is for identifying configuration mistakes in [self-hosted Supabase GrUse the below cURL command to make sure your metrics endpoint returns data:```sh-curl https://<YOUR_PROJECT_REF>.supabase.co/customer/v1/privileged/metrics --user 'service_role:<SECRET_API_KEY>'+curl https://<YOUR_PROJECT_REF>.supabase.co/customer/v1/privileged/metrics --user 'user:<SECRET_API_KEY>'```## Step 2: Set your Grafana Dashboard to auto-refresh in the top right corner@@ -58,7 +58,7 @@ docker exec -it <container id> bashRun the following in the docker container:```sh-printenv | egrep 'GRAFANA_PASSWORD|SUPABASE_PROJECT_REF|SUPABASE_SERVICE_ROLE_KEY'+printenv | egrep 'GRAFANA_PASSWORD|SUPABASE_PROJECT_REF|SUPABASE_SECRET_KEY'```Ensure the values are correct by comparing them with those in the Dashboard. Users have previously encountered issues by accidentally omitting the last character of their strings, so a thorough check is essential.diff --git a/apps/docs/content/troubleshooting/high-latency-with-supabase-client-z0pZzR.mdx b/apps/docs/content/troubleshooting/high-latency-with-supabase-client-z0pZzR.mdxindex f719f49fb28..13ab6fdba1f 100644--- a/apps/docs/content/troubleshooting/high-latency-with-supabase-client-z0pZzR.mdx+++ b/apps/docs/content/troubleshooting/high-latency-with-supabase-client-z0pZzR.mdx@@ -79,7 +79,7 @@ def psycop_call(): #user_ids: list[str]):def supabase_call():- supabase: Client = create_client("SUPABASE_URL", "SUPBASE_SERVICE_ROLE_KEY")+ supabase: Client = create_client("SUPABASE_URL", "SUPABASE_SECRET_KEY")start = time.time()result = supabase.table("your_table_name").select("*").execute()stop = time.time()diff --git a/apps/docs/content/troubleshooting/how-do-i-check-gotrueapi-version-of-a-supabase-project-lQAnOR.mdx b/apps/docs/content/troubleshooting/how-do-i-check-gotrueapi-version-of-a-supabase-project-lQAnOR.mdxindex b674f3649a1..a738c6e3b78 100644--- a/apps/docs/content/troubleshooting/how-do-i-check-gotrueapi-version-of-a-supabase-project-lQAnOR.mdx+++ b/apps/docs/content/troubleshooting/how-do-i-check-gotrueapi-version-of-a-supabase-project-lQAnOR.mdx@@ -9,7 +9,7 @@ database_id = "74972531-f2fc-4d68-a745-21f9c75761e6"Make a `GET` request to the health check endpoint to retrieve this information. Below is an example using `curl`:```-curl -X GET 'https://project-ref.supabase.co/auth/v1/health' -H 'apikey: ANON_KEY'+curl -X GET 'https://project-ref.supabase.co/auth/v1/health' -H 'apikey: PUBLISHABLE_KEY'{"version": "v2.60.7",diff --git a/apps/docs/content/troubleshooting/performing-administration-tasks-on-the-server-side-with-the-servicerole-secret-BYM4Fa.mdx b/apps/docs/content/troubleshooting/performing-administration-tasks-on-the-server-side-with-the-servicerole-secret-BYM4Fa.mdxindex 3caf41e81ea..2452c3defb3 100644--- a/apps/docs/content/troubleshooting/performing-administration-tasks-on-the-server-side-with-the-servicerole-secret-BYM4Fa.mdx+++ b/apps/docs/content/troubleshooting/performing-administration-tasks-on-the-server-side-with-the-servicerole-secret-BYM4Fa.mdx@@ -1,22 +1,22 @@----title = "Performing administration tasks on the server side with the service_role secret"+title = "Performing administration tasks on the server side with a secret key"github_url = "https://github.com/orgs/supabase/discussions/15860"date_created = "2023-07-18T12:25:03+00:00"topics = [ "auth", "platform" ]-keywords = [ "service_role", "server", "security" ]+keywords = [ "secret-key", "server", "security" ]database_id = "0d3389c0-5e75-473c-a18b-0699d0911fb2"----By default, the auth-helpers/ssr do not permit the use of the `service_role` `secret`. This restriction is in place to prevent the accidental exposure of your `service_role` `secret` to the public. Since the auth-helpers/ssr function on both the server and client side, it becomes challenging to separate the key specifically for client-side usage.+By default, server side rendering (SSR) does not permit the use of a `secret` key. This restriction is in place to prevent the accidental exposure of your `secret` key to the public. Since SSR runs on both the server and client side, it becomes challenging to separate the key specifically for client-side usage.-However, there is a solution. You can create a separate Supabase client using the `createClient` method from `@supabase/supabase-js` and provide it with the `service_role` `secret`. In a server environment, you will also need to disable certain properties to ensure proper functionality. See the example code below for the required settings.+However, there is a solution. You can create a separate Supabase client using the `createClient` method from `@supabase/supabase-js` and provide it with the `secret` key. In a server environment, you will also need to disable certain properties to ensure proper functionality. See the example code below for the required settings.-By implementing this approach, you can safely utilize the `service_role` `secret` without compromising security or exposing sensitive information to the public.+By implementing this approach, you can safely utilize the `secret` key without compromising security or exposing sensitive information to the public.```tsimport { createClient } from '@supabase/supabase-js'-const supabase = createClient(supabaseUrl, serviceRoleSecret, {+const supabase = createClient(supabaseUrl, secretKey, {auth: {persistSession: false,autoRefreshToken: false,diff --git a/apps/docs/content/troubleshooting/rls-performance-and-best-practices-Z5Jjwv.mdx b/apps/docs/content/troubleshooting/rls-performance-and-best-practices-Z5Jjwv.mdxindex 329328e618a..a2ef2eaa839 100644--- a/apps/docs/content/troubleshooting/rls-performance-and-best-practices-Z5Jjwv.mdx+++ b/apps/docs/content/troubleshooting/rls-performance-and-best-practices-Z5Jjwv.mdx@@ -17,7 +17,7 @@ See the last section for ways to measure the performance of your queries as you### Is RLS causing performance issues (on a single table query)?-For very slow queries, or if using the tools at end of article, run a query with RLS enabled on the table and then with it disabled (this should only be done in a non production environment). If the results are similar then your query itself is likely the performance issue. Although, remember any join tables in RLS will also need to run their RLS unless a security definer function is used to bypass them. You can also create a service_role client to run the query bypassing RLS if in a secure environment.+For very slow queries, or if using the tools at end of article, run a query with RLS enabled on the table and then with it disabled (this should only be done in a non production environment). If the results are similar then your query itself is likely the performance issue. Although, remember any join tables in RLS will also need to run their RLS unless a security definer function is used to bypass them. You can also create a client using a secret key to run the query bypassing RLS if in a secure environment.### How to improve RLS performance.diff --git a/apps/docs/content/troubleshooting/why-is-my-service-role-key-client-getting-rls-errors-or-not-returning-data-7_1K9z.mdx b/apps/docs/content/troubleshooting/why-is-my-service-role-key-client-getting-rls-errors-or-not-returning-data-7_1K9z.mdxindex 4a89177aa42..56089695b6a 100644--- a/apps/docs/content/troubleshooting/why-is-my-service-role-key-client-getting-rls-errors-or-not-returning-data-7_1K9z.mdx+++ b/apps/docs/content/troubleshooting/why-is-my-service-role-key-client-getting-rls-errors-or-not-returning-data-7_1K9z.mdx@@ -7,7 +7,14 @@ keywords = [ "rls", "service_role", "authorization", "session", "apikey" ]database_id = "677f0a69-e454-4718-ad92-91053d40c085"----A Supabase client with the Authorization header set to the service role API key will ALWAYS bypass RLS. By default the Authorization header is the `apikey` used in `createClient`. If you are getting an RLS error then you have a user session getting into the client or you initialized with the anon key. RLS in enforced based on the `Authorization` header and not the `apikey` header.+<Admonition type="deprecation">++This troubleshooting guide is about rotating **Legacy anon, service_role API keys**. We are deprecating the Legacy API keys, and recommend migrating to New API keys. To learn more about API+keys, refer to [the API documentation](/docs/guides/api/api-keys).++</Admonition>++A Supabase client with the Authorization header set to the service role API key will ALWAYS bypass RLS. By default the Authorization header is the `apikey` used in `createClient`. If you are getting an RLS error then you have a user session getting into the client or you initialized with the publishable key. RLS in enforced based on the `Authorization` header and not the `apikey` header.Three common cases of the `createClient` `apikey` being replaced by a user session/token: