From 017a0eb38cb2723e9795968f7033ecedcd4e9296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramiro=20Nu=C3=B1ez=20Dosio?= Date: Mon, 18 Jul 2022 09:31:50 +0100 Subject: [PATCH 01/21] New redirects - Wrong URL to correct blog post - Waiting for others --- apps/www/next.config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/www/next.config.js b/apps/www/next.config.js index ecb9363a273..4bcf09f1f9b 100644 --- a/apps/www/next.config.js +++ b/apps/www/next.config.js @@ -685,6 +685,16 @@ module.exports = withMDX({ source: '/docs/reference/javascript/supabase-client', destination: '/docs/reference', }, + { + permanent: true, + source: '', + destination: '', + }, + { + permanent: true, + source: 'https://supabase.com/blog/2022/06/15/blog/2022/06/29/visualizing-supabase-data-using-metabase', + destination: 'https://supabase.com/blog/2022/06/29/visualizing-supabase-data-using-metabase', + }, ] }, }) From fc4b8c798167eb6d98b72ac8aaa55995d96dfa9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramiro=20Nu=C3=B1ez=20Dosio?= Date: Mon, 18 Jul 2022 11:58:03 +0100 Subject: [PATCH 02/21] Update next.config.js --- apps/www/next.config.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/www/next.config.js b/apps/www/next.config.js index 4bcf09f1f9b..d203cf30bd2 100644 --- a/apps/www/next.config.js +++ b/apps/www/next.config.js @@ -687,14 +687,19 @@ module.exports = withMDX({ }, { permanent: true, - source: '', - destination: '', + source: 'https://supabase.com/join', + destination: 'https://supabase.com/', }, { permanent: true, source: 'https://supabase.com/blog/2022/06/15/blog/2022/06/29/visualizing-supabase-data-using-metabase', destination: 'https://supabase.com/blog/2022/06/29/visualizing-supabase-data-using-metabase', }, + { + permanent: true, + source: 'https://supabase.com/_app', + destination: 'app.supabase.com', + }, ] }, }) From 3d9720d2eb98d92c382d019bc199c5094559420a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramiro=20Nu=C3=B1ez=20Dosio?= Date: Mon, 18 Jul 2022 14:02:16 +0100 Subject: [PATCH 03/21] Fixed destination. --- apps/www/next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/next.config.js b/apps/www/next.config.js index d203cf30bd2..515e9ed03f0 100644 --- a/apps/www/next.config.js +++ b/apps/www/next.config.js @@ -698,7 +698,7 @@ module.exports = withMDX({ { permanent: true, source: 'https://supabase.com/_app', - destination: 'app.supabase.com', + destination: 'https://app.supabase.com', }, ] }, From d84c30cea4da86931343191ef877819426dc3517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramiro=20Nu=C3=B1ez=20Dosio?= Date: Mon, 18 Jul 2022 17:14:25 +0100 Subject: [PATCH 04/21] Changed urls. --- apps/www/next.config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/www/next.config.js b/apps/www/next.config.js index 515e9ed03f0..bdad9bfb926 100644 --- a/apps/www/next.config.js +++ b/apps/www/next.config.js @@ -687,17 +687,17 @@ module.exports = withMDX({ }, { permanent: true, - source: 'https://supabase.com/join', + source: '/join', destination: 'https://supabase.com/', }, { permanent: true, - source: 'https://supabase.com/blog/2022/06/15/blog/2022/06/29/visualizing-supabase-data-using-metabase', - destination: 'https://supabase.com/blog/2022/06/29/visualizing-supabase-data-using-metabase', + source: 'blog/2022/06/15/blog/2022/06/29/visualizing-supabase-data-using-metabase', + destination: 'blog/2022/06/29/visualizing-supabase-data-using-metabase', }, { permanent: true, - source: 'https://supabase.com/_app', + source: '/_app', destination: 'https://app.supabase.com', }, ] From bdb7f87c15f5befd4616092707d106206b86eade Mon Sep 17 00:00:00 2001 From: dng Date: Mon, 25 Jul 2022 16:16:06 -0700 Subject: [PATCH 05/21] chore: Update humans.txt --- web/static/humans.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/web/static/humans.txt b/web/static/humans.txt index f7fef747b10..3063014db66 100644 --- a/web/static/humans.txt +++ b/web/static/humans.txt @@ -13,6 +13,7 @@ Bo Lu Bobbie Soedirgo Chase Granberry Chris Copplestone +Danny Ng Dave Wilson David Thyresson Div Arora From b54a3eb2575ed12768257b642244468bba13ca2a Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Wed, 27 Jul 2022 18:37:38 +0800 Subject: [PATCH 06/21] Fix missing / in next config --- apps/www/next.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/www/next.config.js b/apps/www/next.config.js index bdad9bfb926..fc8a67925f9 100644 --- a/apps/www/next.config.js +++ b/apps/www/next.config.js @@ -692,8 +692,8 @@ module.exports = withMDX({ }, { permanent: true, - source: 'blog/2022/06/15/blog/2022/06/29/visualizing-supabase-data-using-metabase', - destination: 'blog/2022/06/29/visualizing-supabase-data-using-metabase', + source: '/blog/2022/06/15/blog/2022/06/29/visualizing-supabase-data-using-metabase', + destination: '/blog/2022/06/29/visualizing-supabase-data-using-metabase', }, { permanent: true, From b72b07ba5d66b6de9a5de9f002728e39c6236fb8 Mon Sep 17 00:00:00 2001 From: TzeYiing Date: Thu, 28 Jul 2022 18:39:11 +1000 Subject: [PATCH 07/21] fix: increased contrast for log row icon in dark mode --- studio/components/interfaces/Settings/Logs/LogTable.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/studio/components/interfaces/Settings/Logs/LogTable.tsx b/studio/components/interfaces/Settings/Logs/LogTable.tsx index d2385516f4f..a2fd5a391a1 100644 --- a/studio/components/interfaces/Settings/Logs/LogTable.tsx +++ b/studio/components/interfaces/Settings/Logs/LogTable.tsx @@ -306,8 +306,8 @@ const LogTable = ({ > <>
-
-
+
+
Date: Thu, 28 Jul 2022 08:46:54 -0400 Subject: [PATCH 08/21] chore: add redirect --- apps/www/.env | 5 ++++- apps/www/next.config.js | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/www/.env b/apps/www/.env index 1fdeb47aa32..dcdeb38120f 100644 --- a/apps/www/.env +++ b/apps/www/.env @@ -1,7 +1,10 @@ # this is a public env file + # do not use secrets in this file # Replace this URL with the URL of your blog app + NEXT_PUBLIC_URL="https://localhost:3000" NEXT_PUBLIC_DOCS_URL="http://localhost:3005" -NEXT_PUBLIC_STUDIO_URL="https://localhost:8082" \ No newline at end of file +NEXT_PUBLIC_STUDIO_URL="https://localhost:8082" +NEXT_PUBLIC_LAUNCHWEEKSITE_URL="https://localhost:3008" diff --git a/apps/www/next.config.js b/apps/www/next.config.js index fc8a67925f9..b33ad3a19b4 100644 --- a/apps/www/next.config.js +++ b/apps/www/next.config.js @@ -58,6 +58,14 @@ module.exports = withMDX({ source: '/docs/:path*', destination: `${process.env.NEXT_PUBLIC_DOCS_URL}/:path*`, }, + { + source: '/launch-week', + destination: `${process.env.NEXT_PUBLIC_LAUNCHWEEKSITE_URL}`, + }, + { + source: '/launch-week/:path*', + destination: `${process.env.NEXT_PUBLIC_LAUNCHWEEKSITE_URL}`, + }, // misc rewrites { source: '/humans.txt', From 191ccd33edd3dfe98e5e07cdb6e361732089b817 Mon Sep 17 00:00:00 2001 From: Jonathan Summers-Muir Date: Thu, 28 Jul 2022 10:03:06 -0400 Subject: [PATCH 09/21] Update next.config.js (#7934) --- apps/www/next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/next.config.js b/apps/www/next.config.js index b33ad3a19b4..625e880b532 100644 --- a/apps/www/next.config.js +++ b/apps/www/next.config.js @@ -64,7 +64,7 @@ module.exports = withMDX({ }, { source: '/launch-week/:path*', - destination: `${process.env.NEXT_PUBLIC_LAUNCHWEEKSITE_URL}`, + destination: `${process.env.NEXT_PUBLIC_LAUNCHWEEKSITE_URL}/:path*`, }, // misc rewrites { From e8d1dd33a67c1792e042dd95a7a65429d0ae36a9 Mon Sep 17 00:00:00 2001 From: Chris Bautista Date: Thu, 28 Jul 2022 11:15:13 -0700 Subject: [PATCH 10/21] fix: vercel deploy button for slack clone --- examples/slack-clone/nextjs-slack-clone/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/slack-clone/nextjs-slack-clone/README.md b/examples/slack-clone/nextjs-slack-clone/README.md index accc6749869..34d93ead559 100644 --- a/examples/slack-clone/nextjs-slack-clone/README.md +++ b/examples/slack-clone/nextjs-slack-clone/README.md @@ -39,7 +39,7 @@ The `anon` key is your client-side API key. It allows "anonymous access" to your ### 4. Deploy the Next.js client -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fsupabase%2Fsupabase%2Ftree%2Fmaster%2Fexamples%2slack-clone%2Fnextjs-slack-clone&env=NEXT_PUBLIC_SUPABASE_URL,NEXT_PUBLIC_SUPABASE_KEY&envDescription=Find%20the%20Supabase%20URL%20and%20key%20in%20the%20your%20auto-generated%20docs%20at%20app.supabase.com&project-name=supabase-slack-clone&repo-name=supabase-slack-clone) +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fsupabase%2Fsupabase%2Ftree%2Fmaster%2Fexamples%2Fslack-clone%2Fnextjs-slack-clone&env=NEXT_PUBLIC_SUPABASE_URL,NEXT_PUBLIC_SUPABASE_KEY&envDescription=Find%20the%20Supabase%20URL%20and%20key%20in%20the%20your%20auto-generated%20docs%20at%20app.supabase.com&project-name=supabase-slack-clone&repo-name=supabase-slack-clone) Here, we recommend forking this repo so you can deploy through Vercel by clicking the button above. When you click the button, replace the repo URL with your fork's URL. From f770fac437dac043e3c3be0047b65eada39a16c8 Mon Sep 17 00:00:00 2001 From: Luca Bertelli Date: Fri, 29 Jul 2022 11:37:23 +0200 Subject: [PATCH 11/21] MAILER_SECURE_EMAIL_CHANGE_ENABLED env variable (#7948) * MAILER_SECURE_EMAIL_CHANGE_ENABLED env variable This needs to be better documented also at https://github.com/supabase/gotrue. This env variable can only be found at https://github.com/supabase/gotrue/blob/master/example.env#L38 * MAILER_SECURE_EMAIL_CHANGE_ENABLED env variable See https://github.com/Luca8991/supabase/commit/029ca418cbaddfc9d59c1a96e7e222cdc0195ea6 --- web/docs/gotrue/server/about.md | 4 ++++ web/docs/reference/tools/auth.mdx | 1 + 2 files changed, 5 insertions(+) diff --git a/web/docs/gotrue/server/about.md b/web/docs/gotrue/server/about.md index 4acef396959..1937e117f52 100644 --- a/web/docs/gotrue/server/about.md +++ b/web/docs/gotrue/server/about.md @@ -205,6 +205,10 @@ Controls the minimum amount of time that must pass before sending another signup If you do not require email confirmation, you may set this to `true`. Defaults to `false`. +`MAILER_SECURE_EMAIL_CHANGE_ENABLED` - `bool` + +If `true`, send an email to both the user's current and new email with a confirmation link, otherwise send an email with confirmation link only to new email. Defaults to `true`. + `MAILER_URLPATHS_INVITE` - `string` URL path to use in the user invite email. Defaults to `/`. diff --git a/web/docs/reference/tools/auth.mdx b/web/docs/reference/tools/auth.mdx index 1609b0bf4d5..dcdff06de52 100644 --- a/web/docs/reference/tools/auth.mdx +++ b/web/docs/reference/tools/auth.mdx @@ -108,6 +108,7 @@ These options control the emails sent from GoTrue. | Parameter | Type | Description | | :-------- | :------- | :------------------------- | | `MAILER_AUTOCONFIRM` | `bool` | If you do not require email confirmation, you may set this to `true`. Defaults to `false`. | +| `MAILER_SECURE_EMAIL_CHANGE_ENABLED` | `bool` | If `true`, send an email to both the user's current and new email with a confirmation link, otherwise send an email with confirmation link only to new email. Defaults to `true`. | | `MAILER_OTP_EXP` | `string` | Controls the duration an email link or otp is valid for. Defaults to 24 hrs. | | `MAILER_URLPATHS_INVITE` | `string` | URL path to use in the user invite email. Defaults to `/`. | | `MAILER_URLPATHS_CONFIRMATION` | `string` | URL path to use in the signup confirmation email. Defaults to `/`. | From fef40ace54f9af844cbfd7ee908172dd0a792a9d Mon Sep 17 00:00:00 2001 From: Joel Lee Date: Fri, 29 Jul 2022 19:49:48 +0800 Subject: [PATCH 12/21] Update docker-compose.yml (#7904) --- docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index c9c17cf7fc3..d2f89a20357 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -40,7 +40,7 @@ services: auth: container_name: supabase-auth - image: supabase/gotrue:v2.7.1 + image: supabase/gotrue:v2.10.0 depends_on: - db # Disable this if you are using an external Postgres database restart: unless-stopped From acffe3431bbd50982351d9296890bdfb36b9dc67 Mon Sep 17 00:00:00 2001 From: Francisco Mazzoni Date: Tue, 26 Jul 2022 16:09:36 -0300 Subject: [PATCH 13/21] allow text select on column headers --- studio/styles/grid.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/studio/styles/grid.scss b/studio/styles/grid.scss index bbca5f35d16..2afd89789fa 100644 --- a/studio/styles/grid.scss +++ b/studio/styles/grid.scss @@ -473,7 +473,7 @@ } .sb-grid-column-header__inner__name { - @apply text-scale-1200 overflow-hidden overflow-ellipsis text-xs; + @apply text-scale-1200 overflow-hidden overflow-ellipsis text-xs select-text; } .sb-grid-column-header__inner__format { From 4d2b7699473f0afe9e537c24d26b6ee09553657d Mon Sep 17 00:00:00 2001 From: Francisco Mazzoni Date: Wed, 27 Jul 2022 12:32:14 -0300 Subject: [PATCH 14/21] enforce APSE1 for projects on staging --- studio/lib/constants/infrastructure.ts | 3 ++- studio/pages/new/[slug].tsx | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/studio/lib/constants/infrastructure.ts b/studio/lib/constants/infrastructure.ts index d9a7f5a5475..add3dec7fdd 100644 --- a/studio/lib/constants/infrastructure.ts +++ b/studio/lib/constants/infrastructure.ts @@ -18,7 +18,8 @@ export const REGIONS = { // SOUTH_AFRICA: 'South Africa (Cape Town)', } -export const REGIONS_DEFAULT = REGIONS.EAST_US +export const REGIONS_DEFAULT = + process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging' ? REGIONS.SOUTHEAST_ASIA : REGIONS.EAST_US export const PRICING_TIER_LABELS = { FREE: 'Free', diff --git a/studio/pages/new/[slug].tsx b/studio/pages/new/[slug].tsx index c32a1820e91..359aad2bc6a 100644 --- a/studio/pages/new/[slug].tsx +++ b/studio/pages/new/[slug].tsx @@ -11,7 +11,7 @@ import generator from 'generate-password' import { Button, Listbox, IconUsers, Input, IconLoader, Alert } from '@supabase/ui' import { NextPageWithLayout } from 'types' -import { passwordStrength } from 'lib/helpers' +import { passwordStrength, pluckObjectFields } from 'lib/helpers' import { get, post } from 'lib/common/fetch' import { API_URL, @@ -61,6 +61,7 @@ const Wizard: NextPageWithLayout = () => { const totalFreeProjects = subscriptionStats.total_active_free_projects const freeProjectsLimit = ui.profile?.free_project_limit ?? DEFAULT_FREE_PROJECTS_LIMIT + const availableRegions = getAvailableRegions() const isOrganizationOwner = currentOrg?.is_owner || !app.organizations.isInitialized const isEmptyOrganizations = organizations.length <= 0 && app.organizations.isInitialized @@ -187,6 +188,13 @@ const Wizard: NextPageWithLayout = () => { delayedCheckPasswordStrength(password) } + // [Fran] Enforce APSE1 region on staging + function getAvailableRegions() { + return process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging' + ? pluckObjectFields(REGIONS, ['SOUTHEAST_ASIA']) + : REGIONS + } + return ( { onChange={(value: string) => onDbRegionChange(value)} descriptionText="Select a region close to you for the best performance." > - {Object.keys(REGIONS).map((option: string, i) => { - const label = Object.values(REGIONS)[i] + {Object.keys(availableRegions).map((option: string, i) => { + const label = Object.values(availableRegions)[i] as string return ( { addOnBefore={({ active, selected }: any) => ( )} > From 6d28a963d6f6882781c93802a3984ba6bb343412 Mon Sep 17 00:00:00 2001 From: Francisco Mazzoni Date: Tue, 26 Jul 2022 14:46:18 -0300 Subject: [PATCH 15/21] fix pagination input style, fix debouncing issues, add max input page control --- .../grid/components/footer/pagination/Pagination.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/studio/components/grid/components/footer/pagination/Pagination.tsx b/studio/components/grid/components/footer/pagination/Pagination.tsx index 8bc26536eed..31609a32fd0 100644 --- a/studio/components/grid/components/footer/pagination/Pagination.tsx +++ b/studio/components/grid/components/footer/pagination/Pagination.tsx @@ -28,10 +28,6 @@ const Pagination: FC = () => { const maxPages = Math.ceil(state.totalRows / state.rowsPerPage) const totalPages = state.totalRows > 0 ? maxPages : 1 - useEffect(() => { - if (state.page != page) setPage(state.page) - }, [state.page, page]) - // [Joshen] Oddly without this, state.selectedRows will be stale useEffect(() => {}, [state.selectedRows]) @@ -93,7 +89,7 @@ const Pagination: FC = () => { function onPageChange(event: React.ChangeEvent) { const value = event.target.value - const pageNum = Number(value) + const pageNum = Number(value) > maxPages ? maxPages : Number(value) setPage(pageNum) updatePageDebounced(pageNum, dispatch) } @@ -120,7 +116,6 @@ const Pagination: FC = () => { Date: Thu, 28 Jul 2022 15:20:38 +0200 Subject: [PATCH 16/21] renames Function Hooks to "Database Webhooks" --- .../2021-07-30-supabase-functions-updates.mdx | 16 +-- .../2021-09-10-supabase-beta-august-2021.mdx | 2 +- .../_blog/2021-10-28-supabase-series-a.mdx | 2 +- .../2022-02-22-supabase-beta-january-2022.mdx | 4 +- .../www/pages/partners/integrations/index.tsx | 2 +- .../DatabaseLayout/DatabaseMenu.utils.ts | 2 +- .../project/[ref]/database/hooks/index.tsx | 6 +- web/docs/guides/database.mdx | 114 ++++++++---------- 8 files changed, 65 insertions(+), 83 deletions(-) diff --git a/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx b/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx index 827f4b2cd90..86735235130 100644 --- a/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx +++ b/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx @@ -60,13 +60,15 @@ This is especially true for our Enterprise customers, but also Jamstack develope To meet these goals, we're releasing Supabase Functions in stages: -- _Stage 1:_ Give developers the ability to trigger external HTTP functions - today, using Function Hooks. +- _Stage 1:_ Give developers the ability to trigger external HTTP functions - today, using Database Webhooks. - _Stage 2:_ Give developers the ability to trigger their own Serverless functions on AWS and GCP - Q4 2021. - _Stage 3:_ Release our own Serverless Functions (Supabase Functions) - Q4 for Early Preview customers. ![Supabase Functions timeline](/images/blog/functions-updates/functions-timeline.png) -## Function Hooks (Alpha) +## Database Webhooks (Alpha) + +(Note: Database Webhooks were previosuly named "Function Hooks") Today we're releasing Functions Hooks in `ALPHA`. The `ALPHA` tag means that it is NOT stable, but it's available for testing and feedback. The API will change, so do not use it for anything critical. You have been warned. @@ -76,7 +78,7 @@ Postgres already has the concept of [Triggers](https://www.postgresql.org/docs/c ### Hook Events -Function Hooks allow you to "listen" to any change in your tables to trigger an asynchronous Function. You can hook into a few different events:`INSERT`, `UPDATE`, and `DELETE`. All events are fired **after** a database row is changed. Keen eyes will be able to spot the similarity to Postgres triggers, and that's because Function Hooks are just a convenience wrapper around triggers. +Database Webhooks allow you to "listen" to any change in your tables to trigger an asynchronous Function. You can hook into a few different events:`INSERT`, `UPDATE`, and `DELETE`. All events are fired **after** a database row is changed. Keen eyes will be able to spot the similarity to Postgres triggers, and that's because Database Webhooks are just a convenience wrapper around triggers. ![Hook Events](/images/blog/functions-updates/hook-events.png) @@ -88,7 +90,7 @@ Supabase will support several different targets. - AWS Lambda/Google Cloud Run: Provide Supabase with a restricted IAM role to trigger Serverless functions natively. - Supabase Functions: We'll develop an end-to-end experience. -![Supabase Function Hooks](/images/blog/functions-updates/supabase-function-hooks.png) +![Supabase Database Webhooks](/images/blog/functions-updates/supabase-function-hooks.png) ### Hook Payload @@ -120,14 +122,14 @@ type DeletePayload = { ## Hooks technical design: `pg_net v0.1` -As with most of the Supabase platform, we leverage PostgreSQL's native functionality to implement Function Hooks. +As with most of the Supabase platform, we leverage PostgreSQL's native functionality to implement Database Webhooks (previosuly called "Function Hooks"). To build hooks, we've released a new PostgreSQL Extension, [pg_net](https://github.com/supabase/pg_net/), an asynchronous networking extension with an emphasis on scalability/throughput. In its initial (unstable) release we expose: - asynchronous HTTP `GET` requests. - asynchronous HTTP `POST` requests with a JSON payload. -The extension is (currently) capable of >300 requests per second and is the networking layer underpinning Function Hooks. For a complete view of capabilities, check out [the docs](https://supabase.github.io/pg_net/api/). +The extension is (currently) capable of >300 requests per second and is the networking layer underpinning Database Webhooks. For a complete view of capabilities, check out [the docs](https://supabase.github.io/pg_net/api/). ### **Usage** @@ -244,7 +246,7 @@ This is only the beginning! First we'll thoroughly test it and make a stable rel ## Get started today -Function Hooks is enabled today on all [new projects](https://app.supabase.com). Find it under Database > Alpha Preview > Function Hooks. +Database Webhooks is enabled today on all [new projects](https://app.supabase.com). Find it under Database > Alpha Preview > Database Webhooks. ![Enable hooks](/images/blog/functions-updates/enable-hooks.png) diff --git a/apps/www/_blog/2021-09-10-supabase-beta-august-2021.mdx b/apps/www/_blog/2021-09-10-supabase-beta-august-2021.mdx index 254427ee8f9..0ee022965e3 100644 --- a/apps/www/_blog/2021-09-10-supabase-beta-august-2021.mdx +++ b/apps/www/_blog/2021-09-10-supabase-beta-august-2021.mdx @@ -145,7 +145,7 @@ If you want to keep up to date, make sure you [subscribe to our YouTube channel] - Allow a function with single unnamed parameter to be called with POST
[https://github.com/PostgREST/postgrest/issues/1735](https://github.com/PostgREST/postgrest/issues/1735) -### pg_net (Function Hooks) +### pg_net (Database Webhooks) - Better handling of URL errors
[https://github.com/supabase/pg_net/issues/39](https://github.com/supabase/pg_net/issues/39) diff --git a/apps/www/_blog/2021-10-28-supabase-series-a.mdx b/apps/www/_blog/2021-10-28-supabase-series-a.mdx index 38a83d553cc..33f64259e46 100644 --- a/apps/www/_blog/2021-10-28-supabase-series-a.mdx +++ b/apps/www/_blog/2021-10-28-supabase-series-a.mdx @@ -227,7 +227,7 @@ existing functionality. - **Row Level Security:** restrict user access to data and files using Postgres Policies. - **Realtime data streams:** subscribe to database changes using the logical replication stream. -- **Function Hooks:** trigger external systems using Postgres triggers and our [async request extension](https://github.com/supabase/pg_net/). +- **Database Webhooks (previosuly "Function Hooks"):** trigger external systems using Postgres triggers and our [async request extension](https://github.com/supabase/pg_net/). - **RESTful APIs:** query your database [tables](/docs/reference/javascript/select) and [functions](/docs/reference/javascript/rpc) over HTTP, using [PostgREST](https://postgrest.org). ### Phase 3: Cloud-native PostgreSQL diff --git a/apps/www/_blog/2022-02-22-supabase-beta-january-2022.mdx b/apps/www/_blog/2022-02-22-supabase-beta-january-2022.mdx index aad8eeef5fd..e20790dd937 100644 --- a/apps/www/_blog/2022-02-22-supabase-beta-january-2022.mdx +++ b/apps/www/_blog/2022-02-22-supabase-beta-january-2022.mdx @@ -102,9 +102,9 @@ Check out the new [Remix Auth example](https://github.com/supabase/supabase/tree Our React Native example has been correctly updated to be an Expo example. [Check it out here](https://github.com/supabase/supabase/tree/master/examples/todo-list/expo-todo-list). -## Video: API requests with Function Hooks +## Video: API requests with Database Webhooks -There's no stopping [Jon Meyers](https://jonmeyers.io/videos)! He’s back with an in-depth video on how to easily [automate API requests](https://www.youtube.com/watch?v=codAs9-NeHM&feature=emb_title) using our very own Function Hooks. +There's no stopping [Jon Meyers](https://jonmeyers.io/videos)! He’s back with an in-depth video on how to easily [automate API requests](https://www.youtube.com/watch?v=codAs9-NeHM&feature=emb_title) using our very own Database Webhooks. You'll learn how to listen to _any_ database change, then send those changes [in a payload](https://supabase.com/blog/2021/07/30/supabase-functions-updates#hook-payload) via HTTP request. diff --git a/apps/www/pages/partners/integrations/index.tsx b/apps/www/pages/partners/integrations/index.tsx index 8e30744a075..c1ae01f974d 100644 --- a/apps/www/pages/partners/integrations/index.tsx +++ b/apps/www/pages/partners/integrations/index.tsx @@ -24,7 +24,7 @@ export async function getStaticProps() { props: { partners, }, - // TODO: consider using Next.js' On-demand Revalidation with Supabase function hooks instead + // TODO: consider using Next.js' On-demand Revalidation with Supabase database webhooks instead revalidate: 18000, // In seconds - refresh every 5 hours } } diff --git a/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.ts b/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.ts index 34b383178a2..7388a3542db 100644 --- a/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.ts +++ b/studio/components/layouts/DatabaseLayout/DatabaseMenu.utils.ts @@ -88,7 +88,7 @@ export const generateDatabaseMenu = (project?: Project): ProductMenuGroup[] => { ...(showHooksRoute ? [ { - name: 'Function Hooks', + name: 'Database Webhooks', key: 'hooks', url: `/project/${ref}/database/hooks`, items: [], diff --git a/studio/pages/project/[ref]/database/hooks/index.tsx b/studio/pages/project/[ref]/database/hooks/index.tsx index ad827c89d08..0d845254a20 100644 --- a/studio/pages/project/[ref]/database/hooks/index.tsx +++ b/studio/pages/project/[ref]/database/hooks/index.tsx @@ -170,13 +170,13 @@ const TriggersList: FC = observer( {hooks.length == 0 ? (
createHook()} >

- Function Hooks can be used to trigger serverless functions or send requests to an + Database Webhooks can be used to trigger serverless functions or send requests to an HTTP endpoint.

diff --git a/web/docs/guides/database.mdx b/web/docs/guides/database.mdx index 67f823b2a6d..a63a4110017 100644 --- a/web/docs/guides/database.mdx +++ b/web/docs/guides/database.mdx @@ -4,11 +4,9 @@ title: Database description: Use Supabase to manage your data. --- - -Every Supabase project comes with a full [Postgres](https://www.postgresql.org/) database, a free and open source +Every Supabase project comes with a full [Postgres](https://www.postgresql.org/) database, a free and open source database which is considered one of the world's most stable and advanced databases. - ## Postgres or PostgreSQL? PostgreSQL the database was derived from the POSTGRES Project, a package written at the University of California at Berkeley in 1986. @@ -17,47 +15,41 @@ This package included a query language called "PostQUEL". In 1994, Postgres95 was built on top of POSTGRES code, adding an SQL language interpreter as a replacement for PostQUEL. Eventually, Postgres95 was renamed to PostgreSQL to reflect the SQL query capability. -After this, many people referred to it as Postgres since it's less prone to confusion. Supabase is all about +After this, many people referred to it as Postgres since it's less prone to confusion. Supabase is all about simplicity, so we also refer to it as Postgres. - ## Features -### Table View +### Table View You don't have to be a database expert to start using Supabase. Our table view makes Postgres as easy to use as a spreadsheet. ![Table View.](/img/table-view.png) - ### Relationships -Dig into the relationships within your data. - +Dig into the relationships within your data. - ### Clone tables You can duplicate your tables, just like you would inside a spreadsheet. - ### The SQL Editor -Supabase comes with a SQL Editor. You can also save your favorite queries to run later! +Supabase comes with a SQL Editor. You can also save your favorite queries to run later! - ### Additional features - Supabase extends Postgres with realtime functionality using our [Realtime Server](https://github.com/supabase/realtime). @@ -73,34 +65,34 @@ To expand the functionality of your Postgres database, you can use extensions. You can enable Postgres extensions with the click of a button within the Supabase dashboard. [Learn more](/docs/guides/database/extensions) about all the extensions provided on Supabase. ## Tips -### Realtime +### Realtime -Supabase provides a realtime engine on top of Postgres, so that you can listen to changes as they happen. +Supabase provides a realtime engine on top of Postgres, so that you can listen to changes as they happen. Our realtime engine uses the built-in replication functionality of Postgres. Realtime server broadcasts database changes to authorized users depending on your Row Level Security (RLS) policies. We recommend that you enable row level security and set row security policies on tables that you add to the publication. However, you may choose to disable RLS on a table and have changes broadcast to all connected clients. -You can manage the realtime system, simply by +You can manage the realtime system, simply by [updating](/docs/guides/database/replication) the `supabase_realtime` publication. For example to enable realtime only for individual tables: ```sql -begin; +begin; -- remove the realtime publication - drop publication if exists supabase_realtime; + drop publication if exists supabase_realtime; -- re-create the publication but don't enable it for any tables - create publication supabase_realtime; + create publication supabase_realtime; commit; -- add a table to the publication @@ -110,7 +102,7 @@ alter publication supabase_realtime add table products; alter publication supabase_realtime add table posts; ``` -By default only "new" values are sent, but if you want to receive the old record (previous values) whenever you `update` or `delete` a record, +By default only "new" values are sent, but if you want to receive the old record (previous values) whenever you `update` or `delete` a record, you can update the replica identity of your tables, setting it to `full`: ```sql @@ -119,72 +111,61 @@ alter table your_table replica identity full; ### Migrating between projects -Migrating projects can be achieved using standard PostgreSQL tooling. This is particularly useful for older projects (e.g. to use a newer Postgres version). +Migrating projects can be achieved using standard PostgreSQL tooling. This is particularly useful for older projects (e.g. to use a newer Postgres version). #### Before you begin - Make sure [Postgres](https://www.postgresql.org/download/) is installed so you can run `psql` and `pg_dump`. - Create a new Supabase project. -- If you enabled Function Hooks on your old project, enable it on your new project. +- If you enabled Database Webhooks on your old project, enable it on your new project. - Store the old project's database URL as `$OLD_DB_URL` and the new project's as `$NEW_DB_URL`. #### Migrate the database -1. Run `ALTER ROLE postgres SUPERUSER` in the *old* project's SQL editor +1. Run `ALTER ROLE postgres SUPERUSER` in the _old_ project's SQL editor 2. Run `pg_dump --clean --if-exists --quote-all-identifiers -h $OLD_DB_URL -U postgres > dump.sql` from your terminal -3. Run `ALTER ROLE postgres NOSUPERUSER` in the *old* project's SQL editor -4. Run `ALTER ROLE postgres SUPERUSER` in the *new* project's SQL editor +3. Run `ALTER ROLE postgres NOSUPERUSER` in the _old_ project's SQL editor +4. Run `ALTER ROLE postgres SUPERUSER` in the _new_ project's SQL editor 5. Run `psql -h $NEW_DB_URL -U postgres -f dump.sql` from your terminal -6. Run `TRUNCATE storage.objects` in the *new* project's SQL editor -7. Run `ALTER ROLE postgres NOSUPERUSER` in the *new* project's SQL editor +6. Run `TRUNCATE storage.objects` in the _new_ project's SQL editor +7. Run `ALTER ROLE postgres NOSUPERUSER` in the _new_ project's SQL editor #### Migrate storage objects This script moves storage objects from one project to another. If you have more than 10k objects, we can move the objects for you. Just contact us at [support@supabase.io](mailto:support@supabase.io). ```js -const { createClient } = require("@supabase/supabase-js"); +const { createClient } = require('@supabase/supabase-js') -const OLD_PROJECT_URL = "https://xxx.supabase.co"; -const OLD_PROJECT_SERVICE_KEY = "old-project-service-key-xxx"; +const OLD_PROJECT_URL = 'https://xxx.supabase.co' +const OLD_PROJECT_SERVICE_KEY = 'old-project-service-key-xxx' -const NEW_PROJECT_URL = "https://yyy.supabase.co"; -const NEW_PROJECT_SERVICE_KEY = "new-project-service-key-yyy"; +const NEW_PROJECT_URL = 'https://yyy.supabase.co' +const NEW_PROJECT_SERVICE_KEY = 'new-project-service-key-yyy' -(async () => { - const oldSupabaseRestClient = createClient( - OLD_PROJECT_URL, - OLD_PROJECT_SERVICE_KEY, - { schema: "storage" } - ); - const oldSupabaseClient = createClient( - OLD_PROJECT_URL, - OLD_PROJECT_SERVICE_KEY - ); - const newSupabaseClient = createClient( - NEW_PROJECT_URL, - NEW_PROJECT_SERVICE_KEY - ); +;(async () => { + const oldSupabaseRestClient = createClient(OLD_PROJECT_URL, OLD_PROJECT_SERVICE_KEY, { + schema: 'storage', + }) + const oldSupabaseClient = createClient(OLD_PROJECT_URL, OLD_PROJECT_SERVICE_KEY) + const newSupabaseClient = createClient(NEW_PROJECT_URL, NEW_PROJECT_SERVICE_KEY) // make sure you update max_rows in postgrest settings if you have a lot of objects // or paginate here - const { data: oldObjects, error } = await oldSupabaseRestClient - .from("objects") - .select(); + const { data: oldObjects, error } = await oldSupabaseRestClient.from('objects').select() if (error) { - console.log("error getting objects from old bucket"); - throw error; + console.log('error getting objects from old bucket') + throw error } for (const objectData of oldObjects) { - console.log(`moving ${objectData.id}`); + console.log(`moving ${objectData.id}`) try { - const { data, error: downloadObjectError } = - await oldSupabaseClient.storage - .from(objectData.bucket_id) - .download(objectData.name); + const { data, error: downloadObjectError } = await oldSupabaseClient.storage + .from(objectData.bucket_id) + .download(objectData.name) if (downloadObjectError) { - throw downloadObjectError; + throw downloadObjectError } const { _, error: uploadObjectError } = await newSupabaseClient.storage @@ -193,16 +174,16 @@ const NEW_PROJECT_SERVICE_KEY = "new-project-service-key-yyy"; upsert: true, contentType: objectData.metadata.mimetype, cacheControl: objectData.metadata.cacheControl, - }); + }) if (uploadObjectError) { - throw uploadObjectError; + throw uploadObjectError } } catch (err) { - console.log("error moving ", objectData); - console.log(err); + console.log('error moving ', objectData) + console.log(err) } } -})(); +})() ``` #### Caveats @@ -234,4 +215,3 @@ Read more in [Database Configuration](/docs/guides/database/managing-timezones). - Read more about [Postgres](/docs/postgres/server/about) - Sign in: [app.supabase.com](https://app.supabase.com) - From ec4afa6dcdc38f15c4185066e0ad7279a20c1f1f Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Thu, 28 Jul 2022 22:38:58 +0200 Subject: [PATCH 17/21] Update apps/www/_blog/2021-10-28-supabase-series-a.mdx Co-authored-by: dng --- apps/www/_blog/2021-10-28-supabase-series-a.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/_blog/2021-10-28-supabase-series-a.mdx b/apps/www/_blog/2021-10-28-supabase-series-a.mdx index 33f64259e46..347fed39425 100644 --- a/apps/www/_blog/2021-10-28-supabase-series-a.mdx +++ b/apps/www/_blog/2021-10-28-supabase-series-a.mdx @@ -227,7 +227,7 @@ existing functionality. - **Row Level Security:** restrict user access to data and files using Postgres Policies. - **Realtime data streams:** subscribe to database changes using the logical replication stream. -- **Database Webhooks (previosuly "Function Hooks"):** trigger external systems using Postgres triggers and our [async request extension](https://github.com/supabase/pg_net/). +- **Database Webhooks (previously called "Function Hooks"):** trigger external systems using Postgres triggers and our [async request extension](https://github.com/supabase/pg_net/). - **RESTful APIs:** query your database [tables](/docs/reference/javascript/select) and [functions](/docs/reference/javascript/rpc) over HTTP, using [PostgREST](https://postgrest.org). ### Phase 3: Cloud-native PostgreSQL From 9907233a8106e06d6e1925f84b0dd238de635194 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Thu, 28 Jul 2022 22:39:12 +0200 Subject: [PATCH 18/21] Update apps/www/pages/partners/integrations/index.tsx Co-authored-by: dng --- apps/www/pages/partners/integrations/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/pages/partners/integrations/index.tsx b/apps/www/pages/partners/integrations/index.tsx index c1ae01f974d..bffed18862c 100644 --- a/apps/www/pages/partners/integrations/index.tsx +++ b/apps/www/pages/partners/integrations/index.tsx @@ -24,7 +24,7 @@ export async function getStaticProps() { props: { partners, }, - // TODO: consider using Next.js' On-demand Revalidation with Supabase database webhooks instead + // TODO: consider using Next.js' On-demand Revalidation with Supabase Database Webhooks instead revalidate: 18000, // In seconds - refresh every 5 hours } } From a68c584b04ab7619f260dad7ff52cecda1e8a045 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Thu, 28 Jul 2022 22:39:23 +0200 Subject: [PATCH 19/21] Update apps/www/_blog/2021-07-30-supabase-functions-updates.mdx Co-authored-by: dng --- apps/www/_blog/2021-07-30-supabase-functions-updates.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx b/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx index 86735235130..f3e8a35384d 100644 --- a/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx +++ b/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx @@ -122,7 +122,7 @@ type DeletePayload = { ## Hooks technical design: `pg_net v0.1` -As with most of the Supabase platform, we leverage PostgreSQL's native functionality to implement Database Webhooks (previosuly called "Function Hooks"). +As with most of the Supabase platform, we leverage PostgreSQL's native functionality to implement Database Webhooks (previously called "Function Hooks"). To build hooks, we've released a new PostgreSQL Extension, [pg_net](https://github.com/supabase/pg_net/), an asynchronous networking extension with an emphasis on scalability/throughput. In its initial (unstable) release we expose: From f064431e056271c638bc005e0ac0d9a35973f3f4 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Thu, 28 Jul 2022 22:39:28 +0200 Subject: [PATCH 20/21] Update apps/www/_blog/2021-07-30-supabase-functions-updates.mdx Co-authored-by: dng --- apps/www/_blog/2021-07-30-supabase-functions-updates.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx b/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx index f3e8a35384d..c03e986925c 100644 --- a/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx +++ b/apps/www/_blog/2021-07-30-supabase-functions-updates.mdx @@ -68,7 +68,7 @@ To meet these goals, we're releasing Supabase Functions in stages: ## Database Webhooks (Alpha) -(Note: Database Webhooks were previosuly named "Function Hooks") +(Note: Database Webhooks were previously called "Function Hooks") Today we're releasing Functions Hooks in `ALPHA`. The `ALPHA` tag means that it is NOT stable, but it's available for testing and feedback. The API will change, so do not use it for anything critical. You have been warned. From b46c878b435feba2aa8c18f7c17da141e0b54dbb Mon Sep 17 00:00:00 2001 From: Isaiah Hamilton Date: Fri, 29 Jul 2022 18:34:50 -0400 Subject: [PATCH 21/21] fix: text color --- apps/www/pages/blog/tags/[tag].tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/www/pages/blog/tags/[tag].tsx b/apps/www/pages/blog/tags/[tag].tsx index e8f45366661..ee5747c611e 100644 --- a/apps/www/pages/blog/tags/[tag].tsx +++ b/apps/www/pages/blog/tags/[tag].tsx @@ -36,7 +36,7 @@ function TagBlogsPage(props: Props) {
-
+

Blog