mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 22:59:11 +03:00
Squashed commit of the following:
commit863b287eefAuthor: Aleksi Immonen <aleksi@supabase.io> Date: Tue Jan 28 14:48:46 2025 +0200 Fix www and studio events description grammar/style (#33146) * Update telemetry-constants.ts Fix: www and studio events description grammar and style * Update telemetry-constants.ts commite770d1322fAuthor: Joshen Lim <joshenlimek@gmail.com> Date: Tue Jan 28 17:23:17 2025 +0800 Support dupe query (#33113) * Support dupe query * Update * Small refactor commit36637a8c94Author: Joshen Lim <joshenlimek@gmail.com> Date: Tue Jan 28 17:09:17 2025 +0800 SQL editor persist open close state of each section (#33112) * SQL editor persist open close state of each section * Address feedback commit84ff943f8fAuthor: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Tue Jan 28 15:42:40 2025 +1300 chore: update self-hosted image versions (#33136) chore: update image versions for docker/docker-compose.yml commit3f9e93d659Author: Kang Ming <kang.ming1996@gmail.com> Date: Mon Jan 27 17:22:46 2025 -0800 docs: update phone auth docs (#33135) * docs: state that whatsapp is only supported for Twilio * docs: update format in callout * docs: include twilio verify * fixing capitalization --------- Co-authored-by: Brian B (theOtherBrian1) <brian@supabase.io> commita5b51862b9Author: Charis <26616127+charislam@users.noreply.github.com> Date: Mon Jan 27 19:26:37 2025 -0500 fix:error filter for troubleshooting (#33010) Fix error codes not showing up or not filtering properly in troubleshooting filter. Also fix local dev when local infra is not available. commita255acb5eaAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Mon Jan 27 16:29:29 2025 -0500 chore: add auto-troubleshooting-template to local dev (#33128) Small DX improvement for writing troubleshooting guides. When a new troubleshooting guide is created, it is auto-populated with the tempalte (as long as docs dev is running). commitf3df883c06Author: Greg Richardson <greg.nmr@gmail.com> Date: Mon Jan 27 12:03:46 2025 -0700 fix: adds fallback when wasm is not supported (#33126) commitd35855cb58Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon Jan 27 18:09:58 2025 +0000 feat: update mgmt api docs (#33104) Co-authored-by: phamhieu <689843+phamhieu@users.noreply.github.com> commitaca05551d1Author: Joshen Lim <joshenlimek@gmail.com> Date: Tue Jan 28 00:24:46 2025 +0800 Update GetStartedHero (#33123) commit8b9d5736e4Author: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Mon Jan 27 14:42:27 2025 +0100 chore: Fix Monaco editor in strict mode (#33075) * Move the code for adding code completion definitions to Monaco instance from the sql editor page to a hook. * Use the hook the in the SQL Editor. commit8f90c86050Author: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Mon Jan 27 14:32:03 2025 +0100 chore: Use `react-query` cache for file previews (#23398) * Empty spaces. * Remove prop drilling for selectedFilePreview and just use it from the store. * Add a hook for getting a fetch url. Use it in all places where it's needed. Remove the file cache from the store. * Simplify the onCopyUrl hook further. * Fix some bugs in the preview pane. commit98ca85156aAuthor: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Mon Jan 27 13:04:31 2025 +0100 chore: Use `sql-formatter` for formatting all SQL in the `studio` (#33071) * Bump the sql-formatter dependency. * Add a function formatQuery which is a wrapper around sql-formatter. * Replace all formatSQL features to use the new function formatSql. * Remove unneeded RQ for formatting. * Small fix. commitdbd6c3866dAuthor: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Mon Jan 27 13:03:44 2025 +0100 chore: Bump all versions of `vitest` to the v3+. Fix a vuln in `vite` (#33041) * Bump all versions of vitest to the v3+. * Bump vite to a non-vulnerable version (5.4.12). commitcf75f7a33eAuthor: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Mon Jan 27 12:02:50 2025 +0100 Notification filters: fix icon size (#33117) * fix icon size * undo notifpopover * undo notifpopover commitc96bd5c107Author: Kevin Grüneberg <k.grueneberg1994@gmail.com> Date: Mon Jan 27 18:34:07 2025 +0800 refactor: database size metric for Free Plan (#33039) Instead of basing the database size metric for the Free Plan on summing up the average database size per project in the organization, we are going to simply enforce a database size limit of 0.5 GB per active project. Deleted projects are irrelevant and it should be much easier for customers to understand. We are querying the database size directly via the project to avoid delays. commit4425e05f04Author: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 27 15:40:51 2025 +0800 Update SQL editor search to return a flat list (#33064) * Update SQL editor search to return a flat list * Open folder when clicking on a snippet from searching and snippet belongs to a folder * Update snipet page limit * Set keep previous data true for count * Add hover card for SQL search list * Fix issues from feedback * Make count loader less jarring commit1a3a8cb353Author: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 27 15:17:36 2025 +0800 Add colors quickstart SQL (#33107) * Add colors quickstart SQL * Update enum to be UPPER_CAMEL_CASE commite20c36c505Author: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 27 15:08:26 2025 +0800 Smol fix (#33109) commit3b6a4cd0e2Author: Andrew Valleteau <avallete@users.noreply.github.com> Date: Mon Jan 27 14:17:15 2025 +0900 chore(docs): add new postgres-config delete command docs (#32982) * chore(docs): add new postgres-config delete command docs * chore: docs rephrase * chore: rewrite * chore: update common-cli-sections commit7ad4ad6ee5Author: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 24 21:54:37 2025 -0500 fix: multi-select (#32777) Multi-select has an always-on scrollbar gutter, which is a bit strange-looking and not identifiable as a scrollbar gutter when there's nothing to scroll (I thought it was some weird border for a long time...) Removing it makes it look a bit better commitd5853c7ff3Author: hallidayo <22655069+Hallidayo@users.noreply.github.com> Date: Sat Jan 25 02:09:18 2025 +0000 docs: access control operator type (#33056) cast to text commitf9c2397faaAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 24 20:58:59 2025 -0500 fix: prisma docs (#33017) Replace hardcoded region with placeholder string commita36145494aAuthor: Kamil Ogórek <kamil.ogorek@gmail.com> Date: Fri Jan 24 19:55:50 2025 +0100 docs: Update permissions for Database scope (#33067) commit1c05181eaaAuthor: Greg Richardson <greg.nmr@gmail.com> Date: Fri Jan 24 09:27:23 2025 -0700 blog: change postgres.new links to database.build (#33076) commit219962e0e3Author: Kamil Ogórek <kamil.ogorek@gmail.com> Date: Fri Jan 24 16:07:33 2025 +0100 misc: Disable Sentry Tracing (#33072) commit89c324af84Author: Terry Sutton <saltcod@gmail.com> Date: Fri Jan 24 11:25:41 2025 -0330 fixed: infinite loading in storage explorer rows (#33051) * fixed: infinite loading in storage explorer rows * prettier --------- Co-authored-by: Dhairya Shah <hello@dhairyashah.dev> commit95dccf3cd9Author: Filipe Cabaço <filipe@supabase.io> Date: Fri Jan 24 12:01:49 2025 +0000 realtime: Bump up image (#33066) commitdf6e6c6f8bAuthor: Pamela Chia <pamelachiamayyee@gmail.com> Date: Fri Jan 24 14:49:32 2025 +0800 Feat/add www events (#33031) * feat: add card click events in other pages * feat: add location for hero, nav and banner button clicks * add request demo form event * add newline for long comment/descriptions commit3aec212a60Author: Joshen Lim <joshenlimek@gmail.com> Date: Fri Jan 24 11:08:36 2025 +0800 Hide RLS button for tables in protected schemas (#33038) commit3f6adea49cAuthor: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com> Date: Thu Jan 23 17:50:10 2025 -0500 fix: change functions dependencies url (#33050) * fix: change functions dependencies url * change file name to dependencies.mdx commitd15ae65316Author: Kevin Rocker <kjrocker@users.noreply.github.com> Date: Thu Jan 23 21:43:32 2025 +0100 docs: add async/await JS example to message broadcasting (#31232) * docs: add async/await JS example to message broadcasting * Update Documentation * Make async example more async * Channel name update * Run formatter --------- Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> commitc4b6becdb9Author: Alaister Young <alaister@users.noreply.github.com> Date: Fri Jan 24 02:04:37 2025 +0800 chore: sentry capture profile creation errors (#33048) commit99a042eccaAuthor: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Thu Jan 23 18:06:36 2025 +0100 chore: Set an override for @supabase/auth-js (#33043) Set an override for @supabase/auth-js. commitd8b034ad69Author: Saxon Fletcher <saxonafletcher@gmail.com> Date: Fri Jan 24 02:39:58 2025 +1000 remove globe dependencies (#33033) * remove globe dependencies * Remove unused imports --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> commitf0a24b076fAuthor: Shay Molcho <152275799+shaymolcho@users.noreply.github.com> Date: Thu Jan 23 18:11:51 2025 +0200 Improved punctuation in README (#33040) Enhanced punctuation in the README. These changes enhance the document’s clarity and maintain a uniform structure. commit6477f54610Author: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Thu Jan 23 16:12:52 2025 +0100 Add warnings to logs stacked bar chart (#33036) commit64b7775e2eAuthor: Stojan Dimitrovski <sdimitrovski@gmail.com> Date: Thu Jan 23 14:26:05 2025 +0100 feat: bump `auth-js` to RC 2.68.0 (#32999) commit794529eddfAuthor: Joshen Lim <joshenlimek@gmail.com> Date: Thu Jan 23 17:06:28 2025 +0800 Chore/add export functionality to advisors (#33030) * Add export functionality to security and performance advisors * Add download results button to query performance advisor * Add refresh buttons to security and performance advisors * Add LoadingLine to Query performance to make UI consistent with the other advisors * Minor change commit79e656f735Author: Saxon Fletcher <saxonafletcher@gmail.com> Date: Thu Jan 23 17:16:58 2025 +1000 remove globe in onboarding (#33021) commit154dd0d010Author: Joshen Lim <joshenlimek@gmail.com> Date: Thu Jan 23 14:54:28 2025 +0800 Fix SQL block not rendering if its the only block in the report (#33026) * Fix SQL block not rendering if its the only block in the report * Update commit90a939506cAuthor: Joshen Lim <joshenlimek@gmail.com> Date: Thu Jan 23 13:25:31 2025 +0800 Feat/reports v2/misc wrap up (#32989) * Add telemetry for add SQL block and dragging SQL block from assistant * Add UI indication for drag support block in Assistant * Add UI indication for SQL block support in SQL editor Chart options * Feat/reports v2/create report (#33022) * re-add chart label * fix undefined value * remove mouse over on chart --------- Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> commitd50fa11757Author: Pamela Chia <pamelachiamayyee@gmail.com> Date: Thu Jan 23 09:20:47 2025 +0800 feat: add homepage click events (#33005) * feat: add homepage click events * fix codeowners telemetry filepath commit439f0391c3Author: Abbas Mkhzomi <amkhzomi@gmail.com> Date: Thu Jan 23 03:00:44 2025 +0330 Update laravel.mdx (#32716) commit7463454424Author: Sandeep Salwan <salwansandeep5@gmail.com> Date: Wed Jan 22 16:48:33 2025 -0500 docs: update auth-azure.mdx (#32730) commit4b87612507Author: GauntletRunner2025 <193957098+GauntletRunner2025@users.noreply.github.com> Date: Wed Jan 22 13:29:30 2025 -0600 Update branching.mdx (#32949) commit30c390c19cAuthor: Alaister Young <alaister@users.noreply.github.com> Date: Wed Jan 22 23:52:32 2025 +0800 chore: unify telemetry event sending (#32861) * chore: unify telemetry event sending * organize some imports * remove final useTelemetryProps * add www telemetry actions typing and docs * remove gaevents * fix build * move telemetry identify into PageTelemetry * fix telemetry constants import --------- Co-authored-by: Pamela Chia <pamelachiamayyee@gmail.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> commit1dc92a529dAuthor: Han Qiao <sweatybridge@gmail.com> Date: Wed Jan 22 22:56:40 2025 +0800 docs: update project restore docs for past 90 days backup (#32990) * docs: update project restore docs for past 90 days backup * chore: rephrase a few lines commitfeaf64e55dAuthor: Long Hoang <1732217+loong@users.noreply.github.com> Date: Wed Jan 22 22:41:41 2025 +0800 Fix event grouping (#32928) * fix: pass ref and slug for event grouping * fix: add missing imports * fix: correct types * remove duplicate import * fix: duplicates and extra events from merge --------- Co-authored-by: Pamela Chia <pamelachiamayyee@gmail.com> commitecd7b5f4ddAuthor: Sanden Gocka <sandguitar@gmail.com> Date: Wed Jan 22 02:00:58 2025 -0800 Prototype: Enhance Supabase Studio User Impersonation with External Auth Support (#32786) * feat: add support for impersonation with external auth * update typescript type --------- Co-authored-by: Alaister Young <a@alaisteryoung.com> commit60763ab1e7Author: Joshen Lim <joshenlimek@gmail.com> Date: Wed Jan 22 16:35:52 2025 +0800 Reports V2: support dragging blocks from assistant to custom report (#32964) * Support dragging blocks from assistant to custom report * Show toast when new snippet is created from dragging block into custom report * Only show drag handle for block in assistant panel if in custom reports * Feature flag dragging Assistant query block to custom report * Optimize DX for dragging block into report from assistant * Update import * Remove max width * Fix dragging non sql block causing client crash * Fix chart suffix * Fix tooltip value for non % values * Misc fixes * Support persisting non sql block line or bar view, and fix cancelling not resetting the block state * Update * Preserve chart config when dragging block from assistant to report * Fix commitc635d46b53Author: Joshen Lim <joshenlimek@gmail.com> Date: Wed Jan 22 16:22:45 2025 +0800 Add missing users delete endpoint for local/self-host (#32945) * Add missing users delete endpoint for local/self-host * Update commit45f7561d30Author: Ziinc <Ziinc@users.noreply.github.com> Date: Wed Jan 22 14:26:29 2025 +0800 fix: show database charts at 1h resolution (#32962) * fix: drop default interval * fix: add datepicker override * chore: remove comments commit12645ec023Author: Joshen Lim <joshenlimek@gmail.com> Date: Wed Jan 22 14:26:20 2025 +0800 Fix SQL editor menu wrongly hiding results (#32960) commitcedcc5315fAuthor: Joshen Lim <joshenlimek@gmail.com> Date: Wed Jan 22 14:14:34 2025 +0800 Swap PATCH content to PUT (#32950) * Swap PATCH content to PUT * Fix tests * Swap create Logs Explorer query to use upsert content commit6b4fd6c088Author: Joshen Lim <joshenlimek@gmail.com> Date: Wed Jan 22 13:32:20 2025 +0800 Set chart height to 1 (#32987) commitee9931afd3Author: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Tue Jan 21 18:01:16 2025 +0100 service status: hide info footer if all services OK (#32966) hide if all services are operational commitb5437c630eAuthor: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Tue Jan 21 17:45:06 2025 +0100 feat: Add a banner for clock skew in studio (#32866) * Add a ClockSkewBanner on top of studio. * Fix the color of the RestrictionBanner. * Add an API endpoint which return the current UTC time on the server. * Fix the glob pattern for docs in turbo.json. * Force docs to build. * Revert unneeded changes. * Add feature flag for clock skew banner. * Add a comment. commit3f5e586995Author: Joshen Lim <joshenlimek@gmail.com> Date: Wed Jan 22 00:28:21 2025 +0800 Fix table editor selected row BG color (#32961) commitd9fbf14a81Author: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Tue Jan 21 17:24:42 2025 +0100 Fix chart click (#32834) fix chart click commit3a9e575761Author: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Tue Jan 21 17:11:39 2025 +0100 SQL Charts fixes (#32795) * add better empty states * fix crashes and edge cases * rm unnecessary empty state * move empty state outside chartpanel * validate Y axis before flip to prevent crash * fix flip * disable btn instead of toast * fix types in canFlip * Update tooltip --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> commit3440dc9c95Author: Joshen Lim <joshenlimek@gmail.com> Date: Tue Jan 21 20:56:13 2025 +0800 Feat/reports v2/standardize block design (#32936) * Standardize block designs * Clean up * Add warning threshold colors for infra-monitoring stats * Address all other comments * Swap create custom report to use PUT commitfb569f9a13Author: Alaister Young <alaister@users.noreply.github.com> Date: Tue Jan 21 20:39:41 2025 +0800 fix: local storage test mocks (#32957) commit7a73817316Author: Alaister Young <alaister@users.noreply.github.com> Date: Tue Jan 21 20:25:56 2025 +0800 fix: sign users out if profile request 401s (#32955) * fix: sign users out if profile request 401s * remove console.log commit1f9af325c2Author: Bobbie Soedirgo <31685197+soedirgo@users.noreply.github.com> Date: Tue Jan 21 15:59:50 2025 +0800 docs: add example to order parent table by referenced table (#32920) * docs: add example to order parent table by referenced table * docs: more ordering by referenced table examples commit473c4a5639Author: Alaister Young <alaister@users.noreply.github.com> Date: Tue Jan 21 12:51:11 2025 +0800 chore: skip invalidation on sql only changes (#32934) commit29d72b6249Author: Alaister Young <alaister@users.noreply.github.com> Date: Tue Jan 21 12:07:18 2025 +0800 fix: remove duplicate archive function from pgmq_public (#32942) remove duplicate archive function commit78dee45ae4Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Jan 20 21:49:07 2025 -0500 chore(deps): bump katex from 0.16.10 to 0.16.21 (#32876) Bumps [katex](https://github.com/KaTeX/KaTeX) from 0.16.10 to 0.16.21. - [Release notes](https://github.com/KaTeX/KaTeX/releases) - [Changelog](https://github.com/KaTeX/KaTeX/blob/main/CHANGELOG.md) - [Commits](https://github.com/KaTeX/KaTeX/compare/v0.16.10...v0.16.21) --- updated-dependencies: - dependency-name: katex dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit52735e38bfAuthor: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Mon Jan 20 22:23:45 2025 +0100 chore: Rename all uses of `Tooltip_Shadcn_` to just `Tooltip` (#32860) * Rename all uses of Tooltip_Shadcn_ to just Tooltip. * Fix a leftover change. commit616edd8b5eAuthor: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Mon Jan 20 22:04:05 2025 +0100 chore: Fix the turbo tasks for `docs` app (#32941) * Separate turbo config for docs app into its own separate file. Add a task dependency for codegen tasks. * Fix the clean command. Remove the prebuild command cause it's already covered by turbo. commit5e12593262Author: Han Qiao <sweatybridge@gmail.com> Date: Mon Jan 20 23:45:35 2025 +0800 Update branching docs to mention vercel connection (#32939) commitd1bf79838aAuthor: RampantDespair <63611551+RampantDespair@users.noreply.github.com> Date: Mon Jan 20 09:29:03 2025 -0500 chore: refactor docker-compose.yml unify syntax style (#32668) * Update docker-compose.yml * Moved SECRET_KEY_BASE and VAULT_ENC_KEY to .env commit51d4f053dbAuthor: Nicolas <nicolascamara29@gmail.com> Date: Mon Jan 20 11:11:20 2025 -0300 fix(dashboard): Fixed broken link in the 'secure foreign table' popover (#31855) dashboard: fix broken link commitd139a8f0edAuthor: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 20 21:27:54 2025 +0800 Swap CALL to SELECT for database functions in cron jobs (#32927) commit31da214451Author: Andrew Valleteau <avallete@users.noreply.github.com> Date: Mon Jan 20 21:09:49 2025 +0900 chore(docs): update custom db settings docs (#32853) commit78f7a0439aAuthor: Francesco Sansalvadore <f.sansalvadore@gmail.com> Date: Mon Jan 20 10:34:35 2025 +0100 Fix: mobile styling bugs (#32931) * fix project card height * fix panel notice commit1983f50433Author: Bobbie Soedirgo <31685197+soedirgo@users.noreply.github.com> Date: Mon Jan 20 16:30:35 2025 +0800 chore: vault -> supabase_vault (#32647) commit0a3df2296eAuthor: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Mon Jan 20 09:26:22 2025 +0100 keep polling til all services are healthy (#32794) * keep polling til all services are healthy * fix type errs * use loader in coming up icon * consistent icons commit0129c94cf1Author: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 20 15:49:32 2025 +0800 ReportsV2 P2: Support adding SQL snippets to Reports (#32851) * midway * Render, save, and save configuration of SQL blocks * Fix re ordering of blocks not showing save UI * Remove console log * Smol fix * Add queryHeight param to queryBlock * Reinstate telemetry for run query clicked from assistant * Add * Add resizing * Change compactType * Fix switching reports doesnt update * ONly show date picker if theres a chart thats using daily stats or infra monitoring * Fix client crash * Smol update commitd9a7b43cacAuthor: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 20 14:33:53 2025 +0800 Chore/fix cron job card (#32767) * Add copy action to cron job card command * Fix * Remove unused code * Refactor the cron job parsing. Expanded some of the existing tests. Added more tests. * The last run data can be undefined if the cron was just created. The data for caching in RQ can't be undefined so it's forced to null. * Test whether the edge function points to its own project. If not, parse it as a HTTP request. * Use toStrictEqual instead of toMatchObject for more correct tests. * Add min height to the codeblock, the copy button was obscured if the code was a one-liner. * Add snippet to all types of cron jobs. Automatically update it when the form changes. * Minor fixes. --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com> commit9f9b2be262Author: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 20 14:13:09 2025 +0800 Assistant chat check keycode enter (#32898) commitc5d664d214Author: Alaister Young <alaister@users.noreply.github.com> Date: Mon Jan 20 14:03:28 2025 +0800 fix: don't retry queries on 4xx errors (#32923) commit347dbcc875Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon Jan 20 05:18:11 2025 +0000 feat: update mgmt api docs (#32918) Co-authored-by: phamhieu <689843+phamhieu@users.noreply.github.com> Co-authored-by: Bobbie Soedirgo <31685197+soedirgo@users.noreply.github.com> commit8acc80ec38Author: Pamela Chia <pamelachiamayyee@gmail.com> Date: Mon Jan 20 12:14:22 2025 +0800 feat: pro benefit wording test (#32862) commit9d534c9f5aAuthor: Alaister Young <alaister@users.noreply.github.com> Date: Mon Jan 20 11:27:38 2025 +0800 fix: response error codes (#30581) * fix: response error codes * upgrade docs * remove request url modification middleware * move api routes for self-hosted to platform folder * remove some lib/common/fetch usage * docs: use middleware for openapi-fetch (#30600) Get rid of the unauthedAllowedPost function (I don't think there's any harm in letting any requests that require authentication to just 403, they should be disabled at the React Query level and if not they will fail gracefully enough...) * fix local count query * add default values for clone mutation * fix ts and codegen * add missing lodash dep to playwright tests * Fix the playwright tests to match the new folder structure for selfhosted variant. * remove unused import * Remove unused state * remove unused sql debug mutation * remove unused export * fix notifications query * fix jwt updating status * fix typescript * save sql snippet after renaming * update codegen & fix ts error * override array querySerializer --------- Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com> commitbd0e979f8cAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Sat Jan 18 11:31:40 2025 -0500 fix: search index upload (#32904) Search index pipeline shouldn't be trying to read troubleshooting section yet (those are still searched via GH discussions). Trying to read it errors as they don't have the same frontmatter shape as other guides content. commit2b9d796a2bAuthor: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat Jan 18 01:54:43 2025 +0000 [bot] sync troubleshooting guides to db (#32895) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit25e376a8b1Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat Jan 18 01:53:33 2025 +0000 [bot] fix lint errors (#32894) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commitd1281dad91Author: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 20:47:48 2025 -0500 migrate(docs): troubleshooting 16 (#30953) * migrate(docs): troubleshooting 16 db performance, configuration * Update how-long-does-it-take-to-restore-a-database-from-a-point-in-time-backup-pitr-qO8gOG.mdx Added keywords for PITR restore article * Apply suggestions from code review --------- Co-authored-by: Kevin Brolly <kevin.brolly@supabase.io> commit9742de2ab2Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat Jan 18 01:45:26 2025 +0000 [bot] fix lint errors (#32892) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commitc2ece15f22Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat Jan 18 01:36:49 2025 +0000 [bot] sync troubleshooting guides to db (#32893) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit7837deee41Author: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 20:30:04 2025 -0500 migrate(docs): troubleshooting 12 (#30942) * migrate(docs): troubleshooting 12 database connections * Update database-error-remaining-connection-slots-are-reserved-for-non-replication-superuser-connections-3V3nIb.mdx * Update how-do-i-update-connection-pool-settings-in-my-dashboard-wAxTJ_.mdx Added missing content * Apply suggestions from code review --------- Co-authored-by: Kevin Brolly <kevin.brolly@supabase.io> commita9ed0b4a66Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat Jan 18 01:12:34 2025 +0000 [bot] fix lint errors (#32890) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commit6687baa3e8Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat Jan 18 01:04:38 2025 +0000 [bot] sync troubleshooting guides to db (#32891) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commitc8b9615b34Author: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 19:58:07 2025 -0500 migrate(docs): troubleshooting 13 (#30941) * migrate(docs): troubleshooting 13 dashboard * Update apps/docs/content/troubleshooting/dashboard-errors-when-managing-users-N1ls4A.mdx Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> * Apply suggestions from code review --------- Co-authored-by: Kevin Brolly <kevin.brolly@supabase.io> commitd60410be39Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat Jan 18 00:51:37 2025 +0000 [bot] fix lint errors (#32888) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commitbc67f46cf4Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat Jan 18 00:42:54 2025 +0000 [bot] sync troubleshooting guides to db (#32889) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commitf2c354ef62Author: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 19:36:45 2025 -0500 migrate(docs): troubleshooting 5 (#30943) * migrate(docs): troubleshooting 5 logs, error messages * Delete apps/docs/content/troubleshooting/advanced-filtering-in-the-log-explorer-IJsGQq.mdx | redundant * Apply suggestions from code review * format --------- Co-authored-by: TheOtherBrian1 <91111415+TheOtherBrian1@users.noreply.github.com> commit3fc9dc8dd4Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat Jan 18 00:06:02 2025 +0000 [bot] sync troubleshooting guides to db (#32887) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit929c3c7b4cAuthor: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 19:00:11 2025 -0500 [bot] fix lint errors (#32885) * [bot] fix lint errors * Apply suggestions from code review --------- Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> commitb90467581eAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 18:48:14 2025 -0500 migrate(docs): troubleshooting 14 (#30944) * migrate(docs): troubleshooting 14 rls, supavisor, connections * Update do-i-need-to-expose-security-definer-functions-in-row-level-security-policies-iI0uOw.mdx * Update rls-simplified-BJTcS8.mdx * Apply suggestions from code review * format --------- Co-authored-by: TheOtherBrian1 <91111415+TheOtherBrian1@users.noreply.github.com> commit3723f7cd84Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 23:31:02 2025 +0000 [bot] fix lint errors (#32883) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commit04ff5fe1ebAuthor: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 23:24:29 2025 +0000 [bot] sync troubleshooting guides to db (#32884) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit5ff657a349Author: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 18:17:25 2025 -0500 migrate(docs): troubleshooting 19 (#30945) * migrate(docs): troubleshooting 19 grafana, metrics * Update grafana-not-displaying-data-sXJrMj.mdx * Update grafana-not-displaying-data-sXJrMj.mdx * Update how-to-view-database-metrics-uqf2z_.mdx * Update interpreting-supabase-grafana-io-charts-MUynDR.mdx * added keywords * Apply suggestions from code review --------- Co-authored-by: TheOtherBrian1 <91111415+TheOtherBrian1@users.noreply.github.com> commit7f4cf359f3Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 22:58:25 2025 +0000 [bot] sync troubleshooting guides to db (#32881) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> commit3d45ae3ce9Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 22:29:31 2025 +0000 [bot] sync troubleshooting guides to db (#32882) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commita950511e04Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 22:23:15 2025 +0000 [bot] fix lint errors (#32880) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commitb79f05df90Author: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 17:17:10 2025 -0500 migrate(docs): troubleshooting 23 (#30946) * migrate(docs): troubleshooting 23 postgres performance * Update how-postgres-chooses-which-index-to-use-_JHrf4.mdx * Update memory-and-swap-usage-explained-aPNgm0.mdx --------- Co-authored-by: TheOtherBrian1 <91111415+TheOtherBrian1@users.noreply.github.com> commitb25ae29d1bAuthor: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 22:13:20 2025 +0000 [bot] fix lint errors (#32878) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commit2e77d09960Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 22:07:11 2025 +0000 [bot] sync troubleshooting guides to db (#32879) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit6312618932Author: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 16:49:23 2025 -0500 migrate(docs): troubleshooting 7 (#30936) auth commita42e17d0a9Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 21:43:43 2025 +0000 [bot] sync troubleshooting guides to db (#32874) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit0e60b508f6Author: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 15:52:45 2025 -0500 migrate(docs): troubleshooting 6 (#30935) * migrate(docs): troubleshooting 6 auth * Apply suggestions from code review commit53a8a94a72Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 20:26:53 2025 +0000 [bot] fix lint errors (#32872) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commit8a96b53c64Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 20:20:14 2025 +0000 [bot] sync troubleshooting guides to db (#32873) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit8deced7dabAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 15:00:40 2025 -0500 migrate(docs): troubleshooting 9 (#30937) * migrate(docs): troubleshooting 9 timeouts, latency * light updates * Update NavigationMenu.constants.ts * Update canceling-statement-due-to-statement-timeout-581wFv.mdx Added keyword * Apply suggestions from code review --------- Co-authored-by: Brian Brennglass <brian@Brians-MacBook-Pro.local> Co-authored-by: TheOtherBrian1 <91111415+TheOtherBrian1@users.noreply.github.com> Co-authored-by: Kevin Brolly <kevin.brolly@supabase.io> commitf705b7da60Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 19:15:30 2025 +0000 [bot] sync troubleshooting guides to db (#32871) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit7b1c4e09aeAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 14:08:53 2025 -0500 migrate(docs): troubleshooting 10 (#30938) * migrate(docs): troubleshooting 10 misc database * Apply suggestions from code review commitf2ae79e887Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 19:02:14 2025 +0000 [bot] fix lint errors (#32869) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commit4bd7e9e64fAuthor: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 18:56:49 2025 +0000 [bot] sync troubleshooting guides to db (#32870) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit25306236eaAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 13:49:47 2025 -0500 migrate(docs): troubleshooting 8 (#30939) * migrate(docs): troubleshooting 8 auth * Apply suggestions from code review commitbefb7a9b3cAuthor: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 18:29:47 2025 +0000 [bot] sync troubleshooting guides to db (#32867) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commitecd181bcd9Author: Francesco Sansalvadore <f.sansalvadore@gmail.com> Date: Fri Jan 17 19:07:35 2025 +0100 studio mobile v2 (#32630) * improve some studio mobile layouts * improve some studio mobile layouts * improve settings * assistant mobile * assistant mobile * assistant mobile * responsive formlayout and new project layout * improve dashboard pages headers * improve dashboard auth pages * mobile org settings * mobile billing fixes * adjust paused project container height * remove comments * triggers * leftovers * ai assistant * fix errors * remove 16px input size * fix test * merge access tokens settings page conflicsts * smol integrations here and there commit68f0efcdadAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Fri Jan 17 12:57:47 2025 -0500 migrate(docs): troubleshooting 11 (#30940) * migrate(docs): troubleshooting 11 account and org management * Update check-usage-for-monthly-active-users-mau-MwZaBs.mdx Added Keywords * Update converted-github-account-to-organisation---lost-supabase-account-access-5wsE_1.mdx Changed spelling of organization --------- Co-authored-by: Kevin Brolly <kevin.brolly@supabase.io> commitf2c7e35c23Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 12:55:40 2025 -0500 [bot] fix lint errors (#32846) * [bot] fix lint errors * add capitalization exceptions * Apply suggestions from code review --------- Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> commit84311e7d09Author: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Fri Jan 17 11:08:14 2025 +0100 chore: Fix the env vars for turbo (#31104) * Check all env vars for studio and list them properly in turbo.json. * Check all env vars for design-system. * Fix all env vars for www. * Fix all env vars for docs. * Add the rest of the env vars from the packages folder. * Revert the changes in the sign-in pages. * Remove useless files. Fix a comment. * Fix the links in extensions page to always point to supabase.com/docs. * Change the feature flag rewrite in studio to point to supabase.com/.flags endpoint. * Replace NEXT_PUBLIC_VERCEL_URL with NEXT_PUBLIC_VERCEL_BRANCH_URL because it's more stable on vercel.com. Remove it from apps where it's not needed. * Add env vars from packages. Move all passthrough env vars to env vars since they're stable (don't change between pushes). * Revert changes of studio files. * Minor fixes for the merge commit. * Replace all uses of SITE_URL with LW_URL (they're the same). SITE_ORIGIN is not constructed from env vars. LW_URL is constructed from SITE_ORIGIN and launch_week string. * Use SITE_ORIGIN when fetching the ticket-og. commit8aa5523fccAuthor: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Fri Jan 17 10:54:02 2025 +0100 chore: Migrate tooltips in studio to use shadcn tooltips (#32679) * Remove radix-popover and radix-tooltip as deps from studio. * Migrate all uses of tooltip to shadcn tooltips. * Add tooltip portal to all shadcn tooltips. * Fix a warning about MenuItem not accepting refs in StorageMenu. * Remove unneeded styling for the tooltips. * Set a default delay duration for all tooltips in Studio. * Fix a type error. * Check and fix all tooltips. commit67cbbaacf2Author: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Fri Jan 17 10:52:46 2025 +0100 fix: Unify the design for account pages (#30891) Refactor all account pages to use ScaffoldContainer and have the same design. commitca8ad52188Author: Saxon Fletcher <saxonafletcher@gmail.com> Date: Fri Jan 17 19:50:16 2025 +1000 AI Assistant Performance (#32792) commit4278bd4ec1Author: Kang Ming <kang.ming1996@gmail.com> Date: Thu Jan 16 22:54:21 2025 -0800 fix: bump auth-js version to v2.67.3 (#31217) * fix: bump auth-js version to v2.67.3 * chore: add supabase/auth and supabase/dashboard as codeowners * Revert "chore: add supabase/auth and supabase/dashboard as codeowners" This reverts commit57fc5776ba. * bump supabase-js version * import user type from single gotrue * fix auth-js version in studio * remove auth-js dep in studio * fix ts * use catalog versions * fix ts * Bump realtime-js version to avoid having 2 versions. * Add @supabase/realtime-js to the pnpm catalog. * upgrade realtime-js --------- Co-authored-by: Alaister Young <a@alaisteryoung.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com> commit7ce0038156Author: Andrew Valleteau <avallete@users.noreply.github.com> Date: Fri Jan 17 15:33:15 2025 +0900 chore(docs): add dotenvx example (#31213) * wip * wip * wip * remove seeds * wip * add branching memento * remove triple dots * proofread * chore: mention direct secret usage * chore: update README.md * chore: update docs * fix: .env.local to .env.developemnt * chore: fix typo * chore: fix commands * chore: update README.md * chore: apply PR comments * chore: rename .env.local to .env * chore: simplify dotenvx setup (#32824) * chore: bump cli * chore: disable unused seed --------- Co-authored-by: Han Qiao <sweatybridge@gmail.com> Co-authored-by: Qiao Han <qiao@supabase.io> commit30a86fe0e8Author: Han Qiao <sweatybridge@gmail.com> Date: Fri Jan 17 13:37:56 2025 +0800 docs: clarify the implications of branches auto pausing (#32854) * Remote notice about pausing branches after inactivity * Update branching.mdx * Update branching.mdx * Update branching.mdx * Update branching.mdx commit8c3fd055faAuthor: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Jan 17 00:28:57 2025 +0000 [bot] sync troubleshooting guides to db (#32847) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commita0e144b1a2Author: Charis <26616127+charislam@users.noreply.github.com> Date: Thu Jan 16 19:19:11 2025 -0500 migrate(docs): troubleshooting 25 (#30948) supavisor, db clients commit05dfc56211Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu Jan 16 19:17:17 2025 -0500 [bot] sync troubleshooting guides to db (#32845) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit42efba186bAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Thu Jan 16 19:10:00 2025 -0500 migrate(docs): troubleshooting 24 (#30947) * migrate(docs): troubleshooting 24 nextjs, edge functions * Apply suggestions from code review commitd633ced97dAuthor: Saxon Fletcher <saxonafletcher@gmail.com> Date: Fri Jan 17 09:59:21 2025 +1000 Feat/new project creation experiment (#31237) * some early ideas * better approach * fix globe stuff * add initial step * reset and submit button for chat * cleanup * remove www * more clean up * mobile and more cleanup * fixes * update advanced and security * fix project checks * connect form * fix reset and tidied up other things * add layout options * a/b test * add offset * add ab test * remove www packages * remove www * package * update coordinates * feat: create ProjectCreationInitialStepSubmittedEvent * feat: add event for capturing intention of prompting * fix: bring pnpm-lock up to date * fix ts errors * fix globe * fix globe animation * fix ts * remove imports and tools * update module resolution * global redirect * delay rendering * Update apps/studio/pages/new/[slug].tsx Co-authored-by: Alaister Young <alaister@users.noreply.github.com> * take directly to v2 via project create dropdown * move redirect to useEffect * feat: distinguish events between initial and second step * feat: emit an event when create project is clicked on new/v2 * fix: correct event type defs * remove unused imports * Various clean ups * improvements * Minor refactors * clean up * ts fixes --------- Co-authored-by: Long Hoang <1732217+loong@users.noreply.github.com> Co-authored-by: Alaister Young <alaister@users.noreply.github.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> commita0e3ab86b0Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu Jan 16 18:55:26 2025 -0500 [bot] fix lint errors (#32843) * [bot] fix lint errors * add exception * Apply suggestions from code review --------- Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> commit7587d5048eAuthor: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu Jan 16 18:20:49 2025 -0500 [bot] fix lint errors (#32784) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commit840805672eAuthor: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu Jan 16 18:11:52 2025 -0500 [bot] sync troubleshooting guides to db (#32785) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit31e21d5518Author: Charis <26616127+charislam@users.noreply.github.com> Date: Thu Jan 16 14:00:17 2025 -0500 fix: troubleshooting sync script (#32806) Fix some issues with the script: - GraphQL query strings were built from template literals without escaping, leading to errors when sending to GitHub API, now added escaping - Lack of visibility when GitHub API errors because the actual errors array is buried below the expanded portion of the object output, now drilling down to the usable portion of the returned error - When the sync bot auto-adds the database ID, it also reformats the TOML frontmatter, which leads to a spurious "content changed" update when the checksums don't match in the next check run. Resolve this by normalizing the frontmatter before calculating the checksum. commitbf49d8ab7dAuthor: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Thu Jan 16 18:54:06 2025 +0100 chore: Fix the local studio tests (#32836) * Set a fixed version of ubuntu for running the local studio tests. * Fix a possible yaml issue. * Revert to ubuntu-latest. Try bumping the playwright package. * Add init script to force the navigation menu to not expand. * Another try. * Extend the timeout. * Another try. * Try. * T. * T. * Revert some of the unneeded changes. commit16f950d615Author: Han Qiao <sweatybridge@gmail.com> Date: Fri Jan 17 00:27:26 2025 +0800 Update import-maps.mdx to document deno.json (#32830) * Update import-maps.mdx to document deno.json * Update import-maps.mdx * Update import-maps.mdx * Update import-maps.mdx * Run prettier commit80f4c61f2dAuthor: Etienne Stalmans <staaldraad@users.noreply.github.com> Date: Thu Jan 16 12:28:33 2025 +0100 fix: additional ingest hosts for sentry (#32825) Sentry has US and Europe ingest hosts (us, de). Allow these in CSP commit9ed9938fe0Author: Joshen Lim <joshenlimek@gmail.com> Date: Thu Jan 16 18:26:46 2025 +0800 Add log out route (#32820) commitcfb18eb272Author: Stojan Dimitrovski <sdimitrovski@gmail.com> Date: Thu Jan 16 10:53:02 2025 +0100 docs: add minimal jwt example with custom access token hook (#32770) commit77b76e399aAuthor: Kevin Grüneberg <k.grueneberg1994@gmail.com> Date: Thu Jan 16 14:32:18 2025 +0800 chore: remove react fiber (#32821) Unused, Alaister just added it after I removed it because his subconscious likes to see me suffer commit6b7f3c84a5Author: Kevin Grüneberg <k.grueneberg1994@gmail.com> Date: Thu Jan 16 14:15:40 2025 +0800 chore: bump stripe deps (#32819) Tested locally commitc5fd032a78Author: Han Qiao <sweatybridge@gmail.com> Date: Thu Jan 16 13:12:23 2025 +0800 chore: clarify supported file paths for static files (#32818) commite63a082ddaAuthor: Lakshan Perera <lakshan@supabase.io> Date: Thu Jan 16 09:55:31 2025 +1100 chore(docs): Added a guide on using wasm modules in Edge Functions (#32811) * chore(docs): Added a guide on using wasm modules in Edge Functions * update example * WASM -> Wasm * fix page title commitcdb95a6036Author: Lakshan Perera <lakshan@supabase.io> Date: Thu Jan 16 06:37:21 2025 +1100 chore: add an example for using wasm modules in Edge Functions (#32810) Co-authored-by: Rodrigo Mansueli <rodrigo@mansueli.com> commit9349d22360Author: Lakshan Perera <lakshan@supabase.io> Date: Thu Jan 16 06:30:32 2025 +1100 chore(docs): Added static_files to CLI config (#32801) commitf233c78794Author: Rodrigo Mansueli <rodrigo@mansueli.com> Date: Wed Jan 15 16:28:41 2025 -0300 Chore: update also last example on the page (#32809) commit3e94bc483cAuthor: Rodrigo Mansueli <rodrigo@mansueli.com> Date: Wed Jan 15 15:20:43 2025 -0300 Chore: update edge function example (#32808) Update auth.mdx commit592af2ffa2Author: Francesco Sansalvadore <f.sansalvadore@gmail.com> Date: Wed Jan 15 18:03:22 2025 +0100 feat: careers jobsCount in nav (#32771) * add jobsCount to careers nav * badge styling * mobile career counter * refactor static content generation * refactor * fix gh number formatting * remove comment * remove component * fix fresh local dev & update spacing commit8a648073deAuthor: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Wed Jan 15 17:16:32 2025 +0100 chore: Remove unused published_at field from older blog posts (#32802) Remove unused published_at field from older blog posts. commit8e06301d36Author: Stojan Dimitrovski <sdimitrovski@gmail.com> Date: Wed Jan 15 14:43:18 2025 +0100 docs: remove private alpha docs from firebase tpa (#32797) commit462c3c8cfcAuthor: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Wed Jan 15 11:42:06 2025 +0100 status check (#30204) commit265b4cddd7Author: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Wed Jan 15 10:22:57 2025 +0100 SQL Chart fixes (#32769) * add labels * fix labels, hope to fix Y axis issue * Tiny fix * Make ChartConfig y scrollable * Only show flip CTA if values are all numerical * revert hiding flip button --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> commita2aa5bc83dAuthor: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Wed Jan 15 10:22:13 2025 +0100 feature: Adds logs chart with stacked charts with total errors (#32742) * add logschart with stacked bars * use ui charts pkg * fix contrast * move to ui-patterns * undo areachart * add recharts peerDep * update pckgjson and lock w recharts * feat: enable client-side rendering for LogsBarChart component * fix registry commitc7ebd91740Author: Alaister Young <alaister@users.noreply.github.com> Date: Wed Jan 15 16:42:50 2025 +0800 Revert "Temp disable count query" (#32788) * Revert "Temp disable count query (#31256)" This reverts commit05e06673b4. * update to use new api * only include params if they're not undefined commit0710d62665Author: Joshen Lim <joshenlimek@gmail.com> Date: Wed Jan 15 13:08:26 2025 +0800 ReportsV2 P1: Add Query block component (#32738) * Create QueryBlock component which will be a shared component used in AI Assistant and Reports * Deprecate AIAssistantPanel/SqlSnippet.ts * Fix user messages not getting persisted, only assistant messages * Add loading state to for query results in QueryBlock + hide block view configuration if query block is not chart * Address feedback * Fix TS * fix double border --------- Co-authored-by: Saxon Fletcher <saxonafletcher@gmail.com> commite420a48826Author: Joshen Lim <joshenlimek@gmail.com> Date: Wed Jan 15 12:21:13 2025 +0800 Check for profile in projects, organizations and permissions query (#32759) * Check for profile in projects, organizations and permissions query * Remove unused telemetry function commit15dfe1df8cAuthor: Joshen Lim <joshenlimek@gmail.com> Date: Wed Jan 15 11:56:58 2025 +0800 Fix vault missing exts alert (#32768) * Fix vault missing exts alert * Add minimum version prop commit935c33621dAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Tue Jan 14 20:46:17 2025 -0500 migrate(docs): troubleshooting 27 (#30949) * migrate(docs): troubleshooting 27 misc database * Apply suggestions from code review commit7924b32137Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed Jan 15 00:04:06 2025 +0000 [bot] sync troubleshooting guides to db (#32781) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commit65815efb64Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed Jan 15 00:01:38 2025 +0000 [bot] fix lint errors (#32780) Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> commit000cabd1ddAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Tue Jan 14 18:55:02 2025 -0500 migrate(docs): troubleshooting 29 (#30950) * migrate(docs): troubleshooting 29 misc database * Apply suggestions from code review * Update apps/docs/content/troubleshooting/resolving-database-hostname-and-managing-your-ip-address-pVlwE0.mdx commitb21094cac0Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue Jan 14 23:49:18 2025 +0000 [bot] sync troubleshooting guides to db (#32779) Co-authored-by: github-docs-sync-bot <github-docs-sync-bot@supabase.com> commitf4818474ecAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Tue Jan 14 18:42:31 2025 -0500 migrate(docs): troubleshooting 31 (#30952) * migrate(docs): troubleshooting 31 auth, service role * Apply suggestions from code review commit699f708b0cAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Tue Jan 14 18:38:21 2025 -0500 fix: make examples available for isr (#32610) The examples folder needs to be explicitly included in the Vercel Serverless bundle. Because it's at the root of the monorepo rather than being within the `app/docs` folder, we copy it over pre-build (and pre-dev). Test the examples/prompts fix by re-enabling revalidations on graphql pages. Added a temp version of the fetch function so we can gradually reenable and monitor Vercel error rates over time. commita5daf7cee4Author: Charis <26616127+charislam@users.noreply.github.com> Date: Tue Jan 14 18:21:17 2025 -0500 fix: troubleshooting sync workflow (#32778) Workflow was missed when updating to pnpm commitaf42c0eec4Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue Jan 14 22:42:37 2025 +0000 [bot] fix lint errors (#32776) * [bot] fix lint errors * Update apps/docs/content/troubleshooting/are-all-features-available-in-self-hosted-supabase-THPcqw.mdx --------- Co-authored-by: github-docs-bot <github-docs-bot@supabase.com> Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> commit5690a61bfdAuthor: Charis <26616127+charislam@users.noreply.github.com> Date: Tue Jan 14 17:13:35 2025 -0500 migrate(docs): troubleshooting 4 (#30954) * migrate(docs): troubleshooting 4 self-hosting, local dev * Delete apps/docs/content/troubleshooting/local-development-workflow-is-painfully-slow-eIaTBw.mdx Shouldnt be included * Update apps/docs/content/troubleshooting/are-all-features-available-in-self-hosted-supabase-THPcqw.mdx --------- Co-authored-by: Kevin Brolly <kevin.brolly@supabase.io> commita143d89050Author: Joshen Lim <joshenlimek@gmail.com> Date: Tue Jan 14 23:21:11 2025 +0800 Add set null cta in ForeignRowSelector (#32762) * Add set null cta in ForeignRowSelector * Update UI for foreign key input field in RowEditor commit44d3204b2fAuthor: Terry Sutton <saltcod@gmail.com> Date: Tue Jan 14 11:21:35 2025 -0330 Chore/fix set to now (#32749) * Reuse set to now logic * Ensure set to now cta is visible if column is not nullable * Minor refactor --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> commit692244cc10Author: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Tue Jan 14 15:45:04 2025 +0100 rm monitoring tunnel (#32763) * rm monitoring tunnel * undo formatting * format w prettier i guess * rm route * Add CSP rule for sentry events. --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com> commit53eaab0f71Author: Joshen Lim <joshenlimek@gmail.com> Date: Tue Jan 14 22:09:03 2025 +0800 Show all cron jobs even those with no names (#32765) commit614beac5d9Author: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Tue Jan 14 21:21:49 2025 +1300 chore: update self-hosted image versions (#31184) * chore: update image versions for docker/docker-compose.yml * chore: update image versions for docker/docker-compose.yml * chore: update image versions for docker/docker-compose.yml commit8d1027f58bAuthor: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Tue Jan 14 21:20:26 2025 +1300 chore: update cli reference doc (#32758) commit34424881a1Author: Oliver Rice <github@oliverrice.com> Date: Mon Jan 13 20:59:24 2025 -0600 Revert "Temporarily disable enabling of queues exposure via postgrest" (#32753) * Revert "Temporarily disable enabling of queues exposure via postgrest (#32699)" This reverts commit506fcf5da2. * bugfix: sequence permissions for pgmq_public * Update apps/studio/data/database-queues/database-queues-toggle-postgrest-mutation.ts * enable service role * Smol fix --------- Co-authored-by: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> commitd93c09b03aAuthor: Thor 雷神 Schaeff <5748289+thorwebdev@users.noreply.github.com> Date: Tue Jan 14 10:50:06 2025 +0800 Thor/fix hono example (#32736) * fix: hono example. * fix: hono quickstart. * chore: update numbered list. commitc388cbe9d2Author: Joshen Lim <joshenlimek@gmail.com> Date: Tue Jan 14 10:32:22 2025 +0800 Add disk autoscale configuration parameters in compute and disk settings (#32628) * Add disk autoscale configuration parameters in compute and disk settings * TS fix * Fix * Fixes based on comments * Address all feedbacks * Small tweak --------- Co-authored-by: Alaister Young <a@alaisteryoung.com> commit7a0871b9ceAuthor: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon Jan 13 19:10:31 2025 +0000 feat: update mgmt api docs (#32732) Co-authored-by: phamhieu <689843+phamhieu@users.noreply.github.com> commit1b3a1befa3Author: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 13 23:48:08 2025 +0800 Use whitespace-pre in TextConfirmModal (#32748) commit559236dbd0Author: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 13 23:29:28 2025 +0800 Chore/query performance fixes and improvements (#32747) * Show tab max value in seconds if > 1000ms * Fix incorrect sort option in initial state with no URL state * Fix trim of undefined in Query Performance when retrieving index commitef2ba4a1fcAuthor: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 13 23:19:10 2025 +0800 Add null placeholder to RowEditor foreign key input field (#32744) commit6e0b0237f5Author: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Mon Jan 13 14:01:03 2025 +0100 fix: Remove /members/invite API calls (#32707) Remove /invite API calls. commit5c969f973dAuthor: Joshen Lim <joshenlimek@gmail.com> Date: Mon Jan 13 19:22:35 2025 +0800 Fix view connection string (#32683) commit14d5a79203Author: Francesco Sansalvadore <f.sansalvadore@gmail.com> Date: Mon Jan 13 11:22:04 2025 +0100 Chore: add links to hidden www pages (#32658) * fix vector icon * add supasquad and community content program links to oss page * remove console log commit14ea7a608eAuthor: Kevin Grüneberg <k.grueneberg1994@gmail.com> Date: Mon Jan 13 18:20:51 2025 +0800 docs: credit balance top up / slight copy changes (#32737) commit39f0b5823dAuthor: hallidayo <22655069+Hallidayo@users.noreply.github.com> Date: Mon Jan 13 08:10:42 2025 +0000 deprecated: alerts - usage constant (#32661) switch to admonition commit4577389177Author: Alaister Young <alaister@users.noreply.github.com> Date: Mon Jan 13 13:08:50 2025 +0800 chore: send feature flags for page events (#32590) commit83c94206c2Author: Supun Sudaraka <ssudaraka@gmail.com> Date: Sun Jan 12 08:50:36 2025 +0530 docs: added google consent screen information to google oauth docs (#32703) * added google consent screen information to auth docs * updated the heading to be sentence case * Update apps/docs/content/guides/auth/social-login/auth-google.mdx Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> --------- Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> commitfc6be5284dAuthor: hoshima <hoshima@users.noreply.github.com> Date: Sat Jan 11 12:16:40 2025 +0900 docs: fix typo on quickstarts/hono (#32708) docs: fix quickstarts/hono commit506fcf5da2Author: Joshen Lim <joshenlimek@gmail.com> Date: Fri Jan 10 22:41:27 2025 +0800 Temporarily disable enabling of queues exposure via postgrest (#32699) commit0e930cf940Author: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Fri Jan 10 13:21:53 2025 +0100 r2np: new cost (#32632) * add new cost estimate * fix api types * update api types * restore api.d.ts * fix types * fix utils * clean utils getComputeHourlyPrice --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com> commit2781fb9285Author: Joshen Lim <joshenlimek@gmail.com> Date: Fri Jan 10 16:28:26 2025 +0800 Only show Connect UI in layout header if project is active healthy (#32698) * Only show Connect UI and branching UI in layout header if project is active healthy * Only hide connect UI * Opt for disabled state with tooltip instead commitc791dd9e29Author: Kevin Grüneberg <k.grueneberg1994@gmail.com> Date: Fri Jan 10 10:20:35 2025 +0800 feat: credit top up (#32680) commit84694717e3Author: Wen Bo Xie <5532241+w3b6x9@users.noreply.github.com> Date: Thu Jan 9 13:26:50 2025 -0500 docs: add OpenAI Telemetry opt in permissions (#32667) commitb09bc40225Author: Joshen Lim <joshenlimek@gmail.com> Date: Thu Jan 9 23:20:52 2025 +0800 Remove extend your database header (#32686) commit3122efc7b7Author: Stojan Dimitrovski <sdimitrovski@gmail.com> Date: Thu Jan 9 13:27:02 2025 +0100 feat: make firebase tpa generally available (#32573) * feat: make firebase tpa generally available * Simplify the dropdown menu label. --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com> commit724f046170Author: Marc Köhler <74593656+Than-DE@users.noreply.github.com> Date: Thu Jan 9 12:47:14 2025 +0100 fix(studio): auth email hook sheet padding (#32569) commitab3a3b3c76Author: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Thu Jan 9 12:36:32 2025 +0100 chore: Move playwright tests to tests/local-studio-tests (#21488) * Move the playwright package to tests folder. * Update the workspace list. * Change the name of the playwright tests to local studio tests. commit3d8c0246f5Author: Saxon Fletcher <saxonafletcher@gmail.com> Date: Thu Jan 9 20:30:37 2025 +1000 add assistant to advisor (#32665) * add assistant to advisor * Fix the cursor on the last line to not end in the middle of the textbox. --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com> commit9d6cf3ee51Author: Joshen Lim <joshenlimek@gmail.com> Date: Thu Jan 9 18:06:31 2025 +0800 Add contextual invalidation in SQL Editor (#32675) commiteb867734fbAuthor: Joshen Lim <joshenlimek@gmail.com> Date: Thu Jan 9 16:39:27 2025 +0800 Show MFA warning when field is updated, not until the form is saved (#32673) commiteb42b2c241Author: Joshen Lim <joshenlimek@gmail.com> Date: Thu Jan 9 10:55:14 2025 +0800 Persist last selected database only for sql editor via local storage (#32598) * Persist last selected database only for sql editor via local storage * Add missing useEffect commit3d4cd89a64Author: Charis <26616127+charislam@users.noreply.github.com> Date: Wed Jan 8 18:54:09 2025 -0500 fix: remix pkce example (#32662) commit98d914d1fbAuthor: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Wed Jan 8 21:30:15 2025 +0100 fix: Fix the referer for Posthog (#32656) Fix the referer for posthog. commit11caf61f43Author: Ivan Vasilov <vasilov.ivan@gmail.com> Date: Wed Jan 8 21:29:45 2025 +0100 chore: Delete the `tests` package (#32527) * Remove the tests package. * Remove all workspace configs for the tests package. commit900b4bbad6Author: Charis <26616127+charislam@users.noreply.github.com> Date: Wed Jan 8 15:08:45 2025 -0500 fix: swift ref docs filter params (#32633) Parameters given for `filter` function of Swift SDK don't match actual implementation. Documented as enum, implementation uses string. commit2d2ab28fc9Author: stepan <133258815+stpn48@users.noreply.github.com> Date: Wed Jan 8 17:42:12 2025 +0100 Fix theme toggle bug in footer (#32566) * fix: fix theme button overlap and hydration issues * fix: show sun icon when theme is light and moon when theme is dark * fix: use 'resolvedTheme' isntead of 'theme' to change icon when user has theme 'system' * refactor: use ternary operator commite326e41cefAuthor: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed Jan 8 13:41:12 2025 +0100 chore(deps): bump next from 14.2.15 to 14.2.21 (#32559) * chore(deps): bump next from 14.2.15 to 15.1.3 Bumps [next](https://github.com/vercel/next.js) from 14.2.15 to 15.1.3. - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v14.2.15...v15.1.3) --- updated-dependencies: - dependency-name: next dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Bump next to 14.2.21. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com> commit9b4b66b432Author: Francesco Sansalvadore <f.sansalvadore@gmail.com> Date: Wed Jan 8 12:13:42 2025 +0100 remove lw13 announcements (#32624) commit82bb29a16bAuthor: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Wed Jan 8 12:11:59 2025 +0100 fix: branch dropdown sort & default branch shield (#32650) sort and add shield commit9eb3c22e99Author: Joshen Lim <joshenlimek@gmail.com> Date: Wed Jan 8 18:05:24 2025 +0700 Clean up storage s3 protocol settings dynamic rendering (#32601)
This commit is contained in:
885 files changed
+52806
-17214
No files matched your search
+1
-2
@@ -1,5 +1,6 @@
|
||||
/packages/shared-data/pricing.ts @roryw10 @kevcodez
|
||||
/packages/shared-data/plans.ts @roryw10 @kevcodez
|
||||
/packages/common/telemetry-constants.ts @4L3k51 @loong @pamelachia
|
||||
|
||||
/apps/studio/ @supabase/Dashboard
|
||||
|
||||
@@ -17,5 +18,3 @@
|
||||
/apps/studio/components/interfaces/Organization/BillingSettings/ @supabase/security
|
||||
/apps/studio/components/interfaces/Organization/Documents/ @supabase/security
|
||||
/apps/studio/pages/new/index.tsx @supabase/security
|
||||
|
||||
/apps/studio/lib/constants/telemetry.ts @4L3k51 @loong @pamelachia
|
||||
@@ -29,17 +29,22 @@ jobs:
|
||||
sparse-checkout: |
|
||||
apps/docs
|
||||
|
||||
- name: Set up Node.js
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
with:
|
||||
run_install: false
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'npm'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
run: pnpm i
|
||||
|
||||
- name: Run Troubleshooting script
|
||||
run: npm --prefix=apps/docs run troubleshooting:sync
|
||||
run: pnpm run -F docs troubleshooting:sync
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
name: Playwright Tests
|
||||
name: Local Studio Tests
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'apps/studio/**'
|
||||
- 'tests/local-studio-tests/**'
|
||||
- 'pnpm-lock.yaml'
|
||||
pull_request:
|
||||
branches: [master]
|
||||
paths:
|
||||
- 'apps/studio/**'
|
||||
- 'tests/local-studio-tests/**'
|
||||
- 'pnpm-lock.yaml'
|
||||
|
||||
# Cancel old builds on new commit for same workflow + branch/PR
|
||||
@@ -37,14 +39,14 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: pnpm i
|
||||
- name: Install Playwright Browsers
|
||||
run: pnpm -C playwright-tests exec playwright install --with-deps
|
||||
run: pnpm -C tests/local-studio-tests exec playwright install --with-deps
|
||||
- name: Run Playwright tests
|
||||
run: pnpm run test:playwright
|
||||
run: pnpm test:local-studio
|
||||
# mark the action as succeeded even if the tests failed. This is temporarily until we make the tests more stable.
|
||||
# continue-on-error: true
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-tests/playwright-report/
|
||||
path: tests/local-studio-tests/playwright-report/
|
||||
retention-days: 7
|
||||
+2
-3
@@ -9,13 +9,12 @@ apps/**/out
|
||||
apps/www/schema.sql
|
||||
apps/www/public/images/*
|
||||
apps/docs/**/generated/*
|
||||
apps/docs/examples
|
||||
examples/slack-clone/nextjs-slack-clone/full-schema.sql
|
||||
# ignore files with custom js formatting
|
||||
apps/docs/pages/guides/auth/*.mdx
|
||||
apps/docs/pages/guides/integrations/*.mdx
|
||||
apps/studio/public
|
||||
apps/**/.turbo
|
||||
apps/docs/CONTRIBUTING.md
|
||||
apps/design-system/__registry__
|
||||
packages/icons/__registry__
|
||||
packages/icons/src/icons/*.ts
|
||||
packages/icons/src/icons/*.ts
|
||||
@@ -52,10 +52,10 @@ You can also [self-host](https://supabase.com/docs/guides/hosting/overview) and
|
||||
|
||||
- [Postgres](https://www.postgresql.org/) is an object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.
|
||||
- [Realtime](https://github.com/supabase/realtime) is an Elixir server that allows you to listen to PostgreSQL inserts, updates, and deletes using websockets. Realtime polls Postgres' built-in replication functionality for database changes, converts changes to JSON, then broadcasts the JSON over websockets to authorized clients.
|
||||
- [PostgREST](http://postgrest.org/) is a web server that turns your PostgreSQL database directly into a RESTful API
|
||||
- [PostgREST](http://postgrest.org/) is a web server that turns your PostgreSQL database directly into a RESTful API.
|
||||
- [GoTrue](https://github.com/supabase/gotrue) is a JWT based API for managing users and issuing JWT tokens.
|
||||
- [Storage](https://github.com/supabase/storage-api) provides a RESTful interface for managing Files stored in S3, using Postgres to manage permissions.
|
||||
- [pg_graphql](http://github.com/supabase/pg_graphql/) a PostgreSQL extension that exposes a GraphQL API
|
||||
- [pg_graphql](http://github.com/supabase/pg_graphql/) a PostgreSQL extension that exposes a GraphQL API.
|
||||
- [postgres-meta](https://github.com/supabase/postgres-meta) is a RESTful API for managing your Postgres, allowing you to fetch tables, add roles, and run queries, etc.
|
||||
- [Kong](https://github.com/Kong/kong) is a cloud-native API gateway.
|
||||
|
||||
|
||||
@@ -2161,6 +2161,17 @@ export const Index: Record<string, any> = {
|
||||
subcategory: "undefined",
|
||||
chunks: []
|
||||
},
|
||||
"logs-bar-chart": {
|
||||
name: "logs-bar-chart",
|
||||
type: "components:example",
|
||||
registryDependencies: undefined,
|
||||
component: React.lazy(() => import("@/registry/default/example/logs-bar-chart")),
|
||||
source: "",
|
||||
files: ["registry/default/example/logs-bar-chart.tsx"],
|
||||
category: "undefined",
|
||||
subcategory: "undefined",
|
||||
chunks: []
|
||||
},
|
||||
"chart-area-axes": {
|
||||
name: "chart-area-axes",
|
||||
type: "components:block",
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
'use client'
|
||||
|
||||
import * as React from 'react'
|
||||
import { Provider as JotaiProvider } from 'jotai'
|
||||
import { ThemeProvider as NextThemesProvider } from 'next-themes'
|
||||
import { ThemeProviderProps } from 'next-themes/dist/types'
|
||||
|
||||
import { TooltipProvider_Shadcn_ } from 'ui'
|
||||
import { TooltipProvider } from 'ui'
|
||||
|
||||
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
|
||||
return (
|
||||
<JotaiProvider>
|
||||
<NextThemesProvider {...props}>
|
||||
<TooltipProvider_Shadcn_ delayDuration={0}>{children}</TooltipProvider_Shadcn_>
|
||||
<TooltipProvider delayDuration={0}>{children}</TooltipProvider>
|
||||
</NextThemesProvider>
|
||||
</JotaiProvider>
|
||||
)
|
||||
|
||||
@@ -117,6 +117,11 @@ export const docsConfig: DocsConfig = {
|
||||
href: '/docs/fragments/multi-select',
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
title: 'Logs Bar Chart',
|
||||
href: '/docs/fragments/logs-bar-chart',
|
||||
items: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: Logs Bar Chart
|
||||
description: A stacked bar chart that displays logs errors and successes.
|
||||
fragment: true
|
||||
---
|
||||
|
||||
<ComponentPreview name="logs-bar-chart" peekCode wide />
|
||||
|
||||
## Usage
|
||||
|
||||
This component is used to display the bar chart in logs pages.
|
||||
|
||||
It requires that the `data` prop is an array of objects with the following shape:
|
||||
|
||||
```ts
|
||||
type LogsBarChartDatum = {
|
||||
timestamp: string
|
||||
ok_count: number
|
||||
error_count: number
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
import { LogsBarChart } from 'ui-patterns/LogsBarChart'
|
||||
|
||||
export default function LogsBarChartDemo() {
|
||||
const data = Array.from({ length: 100 }, (_, i) => {
|
||||
const date = new Date()
|
||||
date.setMinutes(date.getMinutes() - i * 5) // Each point 5 minutes apart
|
||||
|
||||
return {
|
||||
timestamp: date.toISOString(),
|
||||
ok_count: Math.floor(Math.random() * 100), // Random value 0-99
|
||||
error_count: Math.floor(Math.random() * 50), // Random value 0-50
|
||||
warning_count: Math.floor(Math.random() * 50), // Random value 0-50
|
||||
}
|
||||
}).reverse()
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<LogsBarChart data={data} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,22 +1,16 @@
|
||||
import { Button } from 'ui'
|
||||
import {
|
||||
Tooltip_Shadcn_,
|
||||
TooltipContent_Shadcn_,
|
||||
TooltipProvider_Shadcn_,
|
||||
TooltipTrigger_Shadcn_,
|
||||
} from 'ui'
|
||||
import { Button, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from 'ui'
|
||||
|
||||
export default function TooltipDemo() {
|
||||
return (
|
||||
<TooltipProvider_Shadcn_>
|
||||
<Tooltip_Shadcn_>
|
||||
<TooltipTrigger_Shadcn_ asChild>
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button type="outline">Hover</Button>
|
||||
</TooltipTrigger_Shadcn_>
|
||||
<TooltipContent_Shadcn_>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>Add to library</p>
|
||||
</TooltipContent_Shadcn_>
|
||||
</Tooltip_Shadcn_>
|
||||
</TooltipProvider_Shadcn_>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
)
|
||||
}
|
||||
@@ -1201,4 +1201,9 @@ export const examples: Registry = [
|
||||
type: 'docs:example',
|
||||
files: ['example/expanding-textarea-demo.tsx'],
|
||||
},
|
||||
{
|
||||
name: 'logs-bar-chart',
|
||||
type: 'components:example',
|
||||
files: ['example/logs-bar-chart.tsx'],
|
||||
},
|
||||
]
|
||||
@@ -26,3 +26,6 @@ yarn-error.log*
|
||||
|
||||
# Sitemap
|
||||
public/sitemap.xml
|
||||
|
||||
# Copied examples folder
|
||||
/examples/
|
||||
@@ -5,7 +5,7 @@ import rehypeSlug from 'rehype-slug'
|
||||
|
||||
import { genGuideMeta } from '~/features/docs/GuidesMdx.utils'
|
||||
import { GuideTemplate, newEditLink } from '~/features/docs/GuidesMdx.template'
|
||||
import { fetchRevalidatePerDay } from '~/features/helpers.fetch'
|
||||
import { fetchRevalidatePerDay_TEMP_TESTING } from '~/features/helpers.fetch'
|
||||
import { UrlTransformFunction, linkTransform } from '~/lib/mdx/plugins/rehypeLinkTransform'
|
||||
import remarkMkDocsAdmonition from '~/lib/mdx/plugins/remarkAdmonition'
|
||||
import { removeTitle } from '~/lib/mdx/plugins/remarkRemoveTitle'
|
||||
@@ -133,7 +133,7 @@ const getContent = async ({ slug }: Params) => {
|
||||
|
||||
const editLink = newEditLink(`${org}/${repo}/blob/${branch}/${docsDir}/${remoteFile}`)
|
||||
|
||||
const response = await fetchRevalidatePerDay(
|
||||
const response = await fetchRevalidatePerDay_TEMP_TESTING(
|
||||
`https://raw.githubusercontent.com/${org}/${repo}/${branch}/${docsDir}/${remoteFile}`
|
||||
)
|
||||
|
||||
|
||||
@@ -5,12 +5,20 @@ const CostWarning = () => (
|
||||
<Admonition type="warning">
|
||||
<p>
|
||||
To keep SMS sending costs under control, make sure you adjust your project's rate limits
|
||||
and <Link href="/guides/auth/auth-captcha">configure CAPTCHA</Link>. See the{' '}
|
||||
<Link href="/guides/platform/going-into-prod">Production Checklist</Link> to learn more.
|
||||
and{' '}
|
||||
<Link href="/guides/auth/auth-captcha">
|
||||
<u>configure CAPTCHA</u>
|
||||
</Link>
|
||||
. See the{' '}
|
||||
<Link href="/guides/platform/going-into-prod">
|
||||
<u>Production Checklist</u>
|
||||
</Link>{' '}
|
||||
to learn more.
|
||||
</p>
|
||||
<br />
|
||||
<p>
|
||||
Some countries have special regulations for services that send SMS messages to users, for
|
||||
example, India's TRAI DLT regulations. Remember to look up and follow the regulations of
|
||||
Some countries have special regulations for services that send SMS messages to users, (e.g
|
||||
India's TRAI DLT regulations). Remember to look up and follow the regulations of
|
||||
countries where you operate.
|
||||
</p>
|
||||
</Admonition>
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
} from 'react'
|
||||
|
||||
import { type Database, useConstant, useIsLoggedIn } from 'common'
|
||||
import { TelemetryActions } from 'common/telemetry-constants'
|
||||
import { Button, cn } from 'ui'
|
||||
|
||||
import { IS_PLATFORM } from '~/lib/constants'
|
||||
@@ -108,9 +109,8 @@ function Feedback({ className }: { className?: string }) {
|
||||
|
||||
function handleVote(response: Response) {
|
||||
sendTelemetryEvent({
|
||||
category: 'docs',
|
||||
action: 'feedback_voted',
|
||||
label: response,
|
||||
action: TelemetryActions.DOCS_FEEDBACK_CLICKED,
|
||||
properties: { response },
|
||||
})
|
||||
sendFeedbackVote(response)
|
||||
dispatch({ event: 'VOTED', response })
|
||||
|
||||
@@ -179,7 +179,6 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
||||
const headers = new Headers()
|
||||
|
||||
if (code) {
|
||||
const cookies = parse(request.headers.get('Cookie') ?? '')
|
||||
const supabase = createServerClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!, {
|
||||
cookies: {
|
||||
getAll() {
|
||||
|
||||
@@ -212,7 +212,8 @@ export const GLOBAL_MENU_ITEMS: GlobalMenuItems = [
|
||||
label: 'Resources',
|
||||
menuItems: [
|
||||
[
|
||||
/* {
|
||||
/*
|
||||
{
|
||||
label: 'Troubleshooting',
|
||||
icon: 'contributing',
|
||||
href: '/guides/troubleshooting',
|
||||
@@ -1322,7 +1323,7 @@ export const functions: NavMenuConstant = {
|
||||
name: 'Guides',
|
||||
url: undefined,
|
||||
items: [
|
||||
{ name: 'Managing dependencies', url: '/guides/functions/import-maps' },
|
||||
{ name: 'Managing dependencies', url: '/guides/functions/dependencies' },
|
||||
{
|
||||
name: 'Managing environment variables',
|
||||
url: '/guides/functions/secrets',
|
||||
@@ -1359,6 +1360,10 @@ export const functions: NavMenuConstant = {
|
||||
name: 'Running AI Models',
|
||||
url: '/guides/functions/ai-models',
|
||||
},
|
||||
{
|
||||
name: 'Wasm modules',
|
||||
url: '/guides/functions/wasm',
|
||||
},
|
||||
{
|
||||
name: 'Deploying with CI / CD pipelines',
|
||||
url: '/guides/functions/cicd-workflow',
|
||||
|
||||
@@ -10,8 +10,8 @@ Claims returned must conform to our specification. Supabase Auth will check for
|
||||
|
||||
These are the fields currently available on an access token:
|
||||
|
||||
Required Claims: `aud`, `exp`, `iat`, `sub`, `email`, `phone`, `role`, `aal`, `session_id`
|
||||
Optional Claims: `jti`, `iss`, `nbf`, `app_metadata`, `user_metadata`, `amr`
|
||||
Required Claims: `iss`, `aud`, `exp`, `iat`, `sub`, `role`, `aal`, `session_id`
|
||||
Optional Claims: `jti`, `nbf`, `app_metadata`, `user_metadata`, `amr`, `email`, `phone`
|
||||
|
||||
**Inputs**
|
||||
|
||||
@@ -205,8 +205,57 @@ Return these only if your hook processed the input without errors.
|
||||
scrollable
|
||||
size="small"
|
||||
type="underlined"
|
||||
defaultActiveId="add-admin-role"
|
||||
defaultActiveId="minimal-jwt"
|
||||
>
|
||||
<TabPanel id="minimal-jwt" label="Minimal JWT">
|
||||
|
||||
Sometimes the size of the JWT can be a problem especially if you're using a [Server-Side Rendering framework](/docs/guides/auth/server-side). Common situations where the JWT can get too large include:
|
||||
|
||||
- The user has a particularly large name, email address or phone number
|
||||
- The default JWT has too many claims coming from OAuth providers
|
||||
- A large avatar URL is included
|
||||
|
||||
To lower the size of the JWT you can define a Custom Access Token hook like the one below which will instruct the Auth server to issue a JWT with only the listed claims. Check the documentation above on what JWT claims must be present and cannot be removed.
|
||||
|
||||
Refer to the [Postgres JSON functions](https://www.postgresql.org/docs/current/functions-json.html) on how to manipulate `jsonb` objects.
|
||||
|
||||
```sql
|
||||
create or replace function public.custom_access_token_hook(event jsonb)
|
||||
returns jsonb
|
||||
language plpgsql
|
||||
as $$
|
||||
declare
|
||||
original_claims jsonb;
|
||||
new_claims jsonb;
|
||||
claim text;
|
||||
begin
|
||||
original_claims = event->'claims';
|
||||
new_claims = '{}'::jsonb;
|
||||
|
||||
foreach claim in array array[
|
||||
-- add claims you want to keep here
|
||||
'iss',
|
||||
'aud',
|
||||
'exp',
|
||||
'iat',
|
||||
'sub',
|
||||
'role',
|
||||
'aal',
|
||||
'session_id'
|
||||
] loop
|
||||
if original_claims ? claim then
|
||||
-- original_claims contains one of the listed claims, set it on new_claims
|
||||
new_claims = jsonb_set(new_claims, array[claim], original_claims->claim);
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
return jsonb_build_object('claims', new_claims);
|
||||
end
|
||||
$$;
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
|
||||
<TabPanel id="add-admin-role" label="Add admin role">
|
||||
|
||||
You can allow registered admin users to perform restricted actions by granting an `admin` claim to their token.
|
||||
|
||||
@@ -3,7 +3,13 @@ title: 'Phone Login'
|
||||
description: 'Learn about logging in to your platform using SMS one-time passwords.'
|
||||
---
|
||||
|
||||
Phone Login is a method of authentication that allows users to log in to a website or application without using a password. The user authenticates through a one-time code sent via SMS.
|
||||
Phone Login is a method of authentication that allows users to log in to a website or application without using a password. The user authenticates through a one-time password (OTP) sent via a channel (SMS or WhatsApp).
|
||||
|
||||
<Admonition type="info">
|
||||
|
||||
At this time, `WhatsApp` is only supported as a channel for the Twilio and Twilio Verify Providers.
|
||||
|
||||
</Admonition>
|
||||
|
||||
Users can also log in with their phones using Native Mobile Login with the built-in identity provider. For Native Mobile Login with Android and iOS, see the [Social Login guides](/docs/guides/auth/social-login).
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ Setting up OAuth with Azure consists of four broad steps:
|
||||
|
||||
- Under Microsoft Entra ID, select _App registrations_ in the side panel and select _New registration._
|
||||
- Choose a name and select your preferred option for the supported account types.
|
||||
- Specify a _Web_ _Redirect URI_. It should should look like this: `https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
- Specify a _Web_ _Redirect URI_. It should look like this: `https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
- Finally, select _Register_ at the bottom of the screen.
|
||||
|
||||

|
||||
|
||||
@@ -778,3 +778,11 @@ chrome.identity.launchWebAuthFlow(
|
||||
|
||||
</TabPanel>
|
||||
</Tabs>
|
||||
|
||||
## Google consent screen
|
||||
|
||||

|
||||
|
||||
By default, the Google consent screen shows the root domain of the callback URL, where Google will send the authentication response. With Supabase Auth, it is your Supabase project's domain `(https://<your-project-ref>.supabase.co)`.
|
||||
|
||||
If that is not preferable, you can use a [Custom Domain](https://supabase.com/docs/guides/platform/custom-domains) with your Supabase project. You can use it as your project's domain when creating the Supabase client in your application and initiating the authentication flow. It will then show up in the Google consent screen. If you want your app name and the logo on the consent screen, [you must submit your app to Google for verification](https://support.google.com/cloud/answer/10311615).
|
||||
+10
-14
@@ -4,19 +4,13 @@ title: 'Firebase Auth'
|
||||
subtitle: 'Use Firebase Auth with your Supabase project'
|
||||
---
|
||||
|
||||
<Admonition type="note">
|
||||
|
||||
Creating a Firebase Auth third-party integration with your Supabase project is currently limited to a private alpha release. We are still trying to improve the developer experience around securing your project. [Register your interest in Third-Party Auth with Firebase](https://forms.supabase.com/third-party-auth-with-firebase) and the team will reach out to you.
|
||||
|
||||
</Admonition>
|
||||
|
||||
Firebase Auth can be used as a third-party authentication provider alongside Supabase Auth, or standalone, with your Supabase project.
|
||||
|
||||
## Getting started
|
||||
|
||||
1. First you need to add an integration to connect your Supabase project with your Firebase project. You will need to get the Project ID in the [Firebase Console](https://console.firebase.google.com/u/0/project/_/settings/general).
|
||||
2. Add a new Third-party Auth integration in your project's [Authentication settings](/dashboard/project/_/settings/auth).
|
||||
3. If you are using Third Party Auth in local development, create and attach restrictive RLS policies to all tables in your public schema, Storage and Realtime to prevent unauthorized access from unrelated Firebase projects.
|
||||
3. If you are using Third Party Auth when self hosting, create and attach restrictive RLS policies to all tables in your public schema, Storage and Realtime to **prevent unauthorized access from unrelated Firebase projects**.
|
||||
4. Assign the `role: 'authenticated'` [custom user claim](https://firebase.google.com/docs/auth/admin/custom-claims) to all your users.
|
||||
5. Finally set up the Supabase client in your application.
|
||||
|
||||
@@ -33,7 +27,7 @@ import { createClient } from '@supabase/supabase-js'
|
||||
|
||||
const supabase = createClient('https://<supabase-project>.supabase.co', 'SUPABASE_ANON_KEY', {
|
||||
accessToken: async () => {
|
||||
;(await firebase.auth().currentUser?.getIdToken(/* forceRefresh */ false)) ?? null
|
||||
return await firebase.auth().currentUser?.getIdToken(/* forceRefresh */ false)) ?? null
|
||||
},
|
||||
})
|
||||
```
|
||||
@@ -123,19 +117,21 @@ enabled = true
|
||||
project_id = "<id>"
|
||||
```
|
||||
|
||||
## Adding an extra layer of security to your project's RLS policies
|
||||
## Adding an extra layer of security to your project's RLS policies (self-hosting only)
|
||||
|
||||
<Admonition type="note">
|
||||
<Admonition type="caution">
|
||||
|
||||
While Third-Party Auth with Firebase is in a private alpha, it is strongly recommended to follow this guide closely. Once it becomes generally available this method would not be necessary to secure your project against unauthorized access from other Firebase projects.
|
||||
**Please follow this section carefully to prevent unauthorized access to your project's data when self-hosting.**
|
||||
|
||||
You should also follow this best practice if self-hosting.
|
||||
When using the Supabase hosted platform, following this step is optional.
|
||||
|
||||
</Admonition>
|
||||
|
||||
Firebase Auth uses a single set of JWT signing keys for all projects. This means that JWTs issued from an unrelated Firebase project to yours could access data in your Supabase project. To guard against this, creating and maintaining the following RLS policies for **all of your tables in the `public` schema** is very important. You should also attach this policy to [Storage](/docs/guides/storage/security/access-control) buckets or [Realtime](/docs/guides/realtime/authorization) channels.
|
||||
Firebase Auth uses a single set of JWT signing keys for all projects. This means that JWTs issued from an unrelated Firebase project to yours could access data in your Supabase project.
|
||||
|
||||
To achieve this we recommend using a [restrictive Postgres Row-Level Security policy](https://www.postgresql.org/docs/current/sql-createpolicy.html).
|
||||
When using the Supabase hosted platform, JWTs coming from Firebase project IDs you have not registered will be rejected before they reach your database. When self-hosting implementing this mechanism is your responsibility. An easy way to guard against this is to create and maintain the following RLS policies for **all of your tables in the `public` schema**. You should also attach this policy to [Storage](/docs/guides/storage/security/access-control) buckets or [Realtime](/docs/guides/realtime/authorization) channels.
|
||||
|
||||
It's recommended you use a [restrictive Postgres Row-Level Security policy](https://www.postgresql.org/docs/current/sql-createpolicy.html).
|
||||
|
||||
Restrictive RLS policies differ from regular (or permissive) policies in that they use the `as restrictive` clause when being defined. They do not grant permissions, but rather restrict any existing or future permissions. They're great for cases like this where the technical limitations of Firebase Auth remain separate from your app's logic.
|
||||
|
||||
|
||||
@@ -120,9 +120,12 @@ The following parameters are available for overrides:
|
||||
1. [max_worker_processes](https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-MAX-WORKER-PROCESSES) (CLI only)
|
||||
1. [session_replication_role](https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-SESSION-REPLICATION-ROLE)
|
||||
1. [shared_buffers](https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-SHARED-BUFFERS) (CLI only)
|
||||
1. [statement_timeout](https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-STATEMENT-TIMEOUT)
|
||||
1. [track_activity_query_size](https://www.postgresql.org/docs/current/runtime-config-statistics.html#GUC-TRACK-ACTIVITY-QUERY-SIZE)
|
||||
1. [track_commit_timestamp](https://www.postgresql.org/docs/current/runtime-config-replication.html#GUC-TRACK-COMMIT-TIMESTAMP)
|
||||
1. [wal_keep_size](https://www.postgresql.org/docs/current/runtime-config-replication.html#GUC-WAL-KEEP-SIZE) (CLI only)
|
||||
1. [wal_sender_timeout](https://www.postgresql.org/docs/current/runtime-config-replication.html#GUC-WAL-SENDER-TIMEOUT) (CLI only)
|
||||
1. [work_mem](https://www.postgresql.org/docs/current/runtime-config-replication.html#GUC-WAL-SENDER-TIMEOUT)
|
||||
1. [work_mem](https://www.postgresql.org/docs/current/runtime-config-resource.html#GUC-WORK-MEM)
|
||||
|
||||
#### Managing Postgres configuration with the CLI
|
||||
|
||||
@@ -148,6 +151,22 @@ postgres-config update --config max_parallel_workers=3 \
|
||||
--replace-existing-overrides
|
||||
```
|
||||
|
||||
To delete specific configuration overrides, use the `postgres-config delete` command:
|
||||
|
||||
```bash
|
||||
supabase --experimental \
|
||||
--project-ref <project-ref> \
|
||||
postgres-config delete --config shared_buffers,work_mem
|
||||
```
|
||||
|
||||
By default, this might restart the database after deleting the configurations. You can use the `--no-restart` flag to prevent the restart:
|
||||
|
||||
```bash
|
||||
supabase --experimental \
|
||||
--project-ref <project-ref> \
|
||||
postgres-config delete --config shared_buffers --no-restart
|
||||
```
|
||||
|
||||
### Resetting to default config
|
||||
|
||||
To reset a setting to its default value at the database level:
|
||||
@@ -168,6 +187,6 @@ alter role "<role_name>" set "<setting_name>" to default;
|
||||
|
||||
### Considerations
|
||||
|
||||
1. Changes through the CLI must restart the database and will cause momentary disruption to existing database connections; in most cases this should not take more than a few seconds. However, you can use the --no-restart flag to bypass the restart and keep the connections intact. Keep in mind that this depends on the specific configuration changes you’re making. if the change requires a restart, using the --no-restart flag will prevent the restart but you won’t see those changes take effect until a restart is manually triggered.
|
||||
1. Changes through the CLI might restart the database causing momentary disruption to existing database connections; in most cases this should not take more than a few seconds. However, you can use the --no-restart flag to bypass the restart and keep the connections intact. Keep in mind that this depends on the specific configuration changes you're making. if the change requires a restart, using the --no-restart flag will prevent the restart but you won't see those changes take effect until a restart is manually triggered.
|
||||
1. Custom Postgres Config will always override the default optimizations generated by Supabase. When changing compute add-ons, you should also review and update your custom Postgres Config to ensure they remain compatible and effective with the updated compute.
|
||||
1. Some parameters (e.g. `wal_keep_size`) can increase disk utilization, triggering disk expansion, which in turn can lead to [increases in your bill](/docs/guides/platform/compute-add-ons#disk-io).
|
||||
@@ -140,7 +140,7 @@ If you plan to solely use Prisma instead of the Supabase Data API (PostgREST), t
|
||||
In your .env file, set the DATABASE_URL variable to your connection string
|
||||
```text .env
|
||||
# Used for Prisma Migrations and within your application
|
||||
DATABASE_URL="postgres://[DB-USER].[PROJECT-REF]:[PRISMA-PASSWORD]@aws-0-us-east-1.pooler.supabase.com:5432/postgres"
|
||||
DATABASE_URL="postgres://[DB-USER].[PROJECT-REF]:[PRISMA-PASSWORD]@[DB-REGION].pooler.supabase.com:5432/postgres"
|
||||
```
|
||||
|
||||
Change your string's `[DB-USER]` to `prisma` and add the password you created in step 1
|
||||
|
||||
@@ -24,7 +24,14 @@ If you understand Git, you already understand Supabase Branching.
|
||||
- **Supabase Project**: You need an existing Supabase project.
|
||||
- **GitHub Repository**: Your project must be connected to a GitHub repository containing your Supabase directory.
|
||||
|
||||
You can run multiple Preview Branches for every Supabase project. Branches contain all the Supabase features with their own API credentials. Preview Environments pause automatically after <SharedData data="config">branching.inactivity_period_in_minutes</SharedData> minutes of inactivity. Note that `pg_cron` executions will be impacted by inactivity related pausing.
|
||||
You can run multiple Preview Branches for every Supabase project. Branches contain all the Supabase features with their own API credentials.
|
||||
|
||||
Preview Environments auto-pause after <SharedData data="config">branching.inactivity_period_in_minutes</SharedData> minutes of inactivity. Upon receiving a new request to your database or REST API, the paused branch will automatically resume to serve the request. The implications of this architecture means
|
||||
|
||||
- `pg_cron` jobs will not execute in an auto-paused database.
|
||||
- Larger variance in request latency due to database cold starts.
|
||||
|
||||
If you need higher performance guarantees on your Preview Environment, you can switch individual branches to [persistent](/docs/guides/deployment/branching#persistent-branches) so they are not auto-paused.
|
||||
|
||||
<Image
|
||||
zoomable
|
||||
@@ -576,8 +583,10 @@ For branching to work with Vercel, you also need the [Vercel GitHub integration]
|
||||
|
||||
</Admonition>
|
||||
|
||||
Supabase automatically updates your Vercel project with the correct environment variables for the corresponding preview branches.
|
||||
The synchronization happens at the time of Pull Request being opened, not at the time of branch creation.
|
||||
And make sure you have [connected](/dashboard/org/_/integrations) your Supabase project to your Vercel project.
|
||||
|
||||
Supabase automatically updates your Vercel project with the correct environment variables for the corresponding preview branches. The synchronization happens at the time of Pull Request being opened, not at the time of branch creation.
|
||||
|
||||
As branching integration is tied to the Preview Deployments feature in Vercel, there are possible race conditions between Supabase setting correct variables, and Vercel running a deployment process. Because of that, Supabase is always automatically re-deploying the most recent deployment of the given pull request.
|
||||
|
||||
## Other Git providers
|
||||
@@ -613,7 +622,7 @@ The new preview branch is reseeded from the `./supabase/seed.sql` file by defaul
|
||||
|
||||
### Deployment failures
|
||||
|
||||
A deployment might fail for various reasons, including invalid SQL statements and schema conflicts in migrations. Errors within the `config.toml` config or something else.
|
||||
A deployment might fail for various reasons, including invalid SQL statements and schema conflicts in migrations, errors within the `config.toml` config, or something else.
|
||||
|
||||
To check the error message, see the Supabase workflow run for your branch under the [View logs](/dashboard/project/_/branches) section.
|
||||
|
||||
|
||||
@@ -16,12 +16,15 @@ import { createClient } from 'jsr:@supabase/supabase-js@2'
|
||||
|
||||
Deno.serve(async (req: Request) => {
|
||||
|
||||
const authHeader = req.headers.get('Authorization')!
|
||||
const supabaseClient = createClient(
|
||||
Deno.env.get('SUPABASE_URL') ?? '',
|
||||
Deno.env.get('SUPABASE_ANON_KEY') ?? '',
|
||||
{ global: { headers: { Authorization: authHeader } } }
|
||||
)
|
||||
);
|
||||
|
||||
// Get the session or user object
|
||||
const authHeader = req.headers.get('Authorization')!;
|
||||
const token = authHeader.replace('Bearer ', '');
|
||||
const { data } = await supabaseClient.auth.getUser(token);
|
||||
|
||||
})
|
||||
```
|
||||
@@ -68,11 +71,13 @@ Deno.serve(async (req: Request) => {
|
||||
const supabaseClient = createClient(
|
||||
Deno.env.get('SUPABASE_URL') ?? '',
|
||||
Deno.env.get('SUPABASE_ANON_KEY') ?? '',
|
||||
{ global: { headers: { Authorization: req.headers.get('Authorization')! } } }
|
||||
)
|
||||
);
|
||||
|
||||
// Database queries will have RLS policies enforced
|
||||
const { data, error } = await supabaseClient.from('profiles').select('*')
|
||||
// Get the session or user object
|
||||
const authHeader = req.headers.get('Authorization')!;
|
||||
const token = authHeader.replace('Bearer ', '');
|
||||
const { data: userData } = await supabaseClient.auth.getUser(token);
|
||||
const { data, error } = await supabaseClient.from('profiles').select('*');
|
||||
|
||||
return new Response(JSON.stringify({ data }), {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
||||
+10
-10
@@ -51,11 +51,11 @@ In the Deno ecosystem, each function should be treated as an independent project
|
||||
- Makes deployments more predictable and maintainable
|
||||
- Allows for different versions of the same dependency across functions
|
||||
|
||||
For these reasons, we recommend maintaining separate configuration files (`deno.json`/`deno.jsonc`, `.npmrc`, or `import_map.json`) within each function's directory, even if it means duplicating some configurations.
|
||||
For these reasons, we recommend maintaining separate configuration files (`deno.json`, `.npmrc`, or `import_map.json`) within each function's directory, even if it means duplicating some configurations.
|
||||
|
||||
There are two ways to manage your dependencies in Supabase Edge Functions:
|
||||
|
||||
### Using deno.jsonc (recommended)
|
||||
### Using deno.json (recommended)
|
||||
|
||||
<Admonition type="info">
|
||||
|
||||
@@ -63,7 +63,7 @@ This feature requires Supabase CLI version 1.215.0 or higher.
|
||||
|
||||
</Admonition>
|
||||
|
||||
Each function should have its own `deno.jsonc` or `deno.json` file to manage dependencies and configure Deno-specific settings. This ensures proper isolation between functions and is the recommended approach for deployment. For a complete list of supported options, see the [official Deno configuration documentation](https://docs.deno.com/runtime/manual/getting_started/configuration_file).
|
||||
Each function should have its own `deno.json` file to manage dependencies and configure Deno-specific settings. This ensures proper isolation between functions and is the recommended approach for deployment. For a complete list of supported options, see the [official Deno configuration documentation](https://docs.deno.com/runtime/manual/getting_started/configuration_file).
|
||||
|
||||
```json supabase/functions/my-function/deno.json
|
||||
{
|
||||
@@ -80,24 +80,24 @@ The recommended file structure for deployment:
|
||||
├── functions
|
||||
│ ├── function-one
|
||||
│ │ ├── index.ts
|
||||
│ │ ├─- deno.jsonc # Function-specific Deno configuration
|
||||
│ │ ├─- deno.json # Function-specific Deno configuration
|
||||
│ │ └── .npmrc # Function-specific npm configuration (if needed)
|
||||
│ └── function-two
|
||||
│ ├── index.ts
|
||||
│ ├─- deno.jsonc # Function-specific Deno configuration
|
||||
│ ├─- deno.json # Function-specific Deno configuration
|
||||
│ └── .npmrc # Function-specific npm configuration (if needed)
|
||||
└── config.toml
|
||||
```
|
||||
|
||||
<Admonition type="caution">
|
||||
While it's possible to use a global `deno.json` or `deno.jsonc` in the `/supabase/functions`
|
||||
directory for local development, this approach is not recommended for deployment. Each function
|
||||
should maintain its own configuration to ensure proper isolation and dependency management.
|
||||
While it's possible to use a global `deno.json` in the `/supabase/functions` directory for local
|
||||
development, this approach is not recommended for deployment. Each function should maintain its
|
||||
own configuration to ensure proper isolation and dependency management.
|
||||
</Admonition>
|
||||
|
||||
### Using import maps (legacy)
|
||||
|
||||
Import Maps are a legacy way to manage dependencies, similar to a `package.json` file. While still supported, we recommend using `deno.jsonc`. If both exist, `deno.jsonc` takes precedence.
|
||||
Import Maps are a legacy way to manage dependencies, similar to a `package.json` file. While still supported, we recommend using `deno.json`. If both exist, `deno.json` takes precedence.
|
||||
|
||||
Each function should have its own `import_map.json` file for proper isolation:
|
||||
|
||||
@@ -161,7 +161,7 @@ To use private npm packages, create a `.npmrc` file within your function directo
|
||||
└── functions
|
||||
└── my-function
|
||||
├── index.ts
|
||||
├── deno.jsonc
|
||||
├── deno.json
|
||||
└── .npmrc # Function-specific npm configuration
|
||||
```
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
---
|
||||
id: 'function-wasm'
|
||||
title: 'Using Wasm modules'
|
||||
description: 'How to use WebAssembly in Edge Functions.'
|
||||
subtitle: 'How to use WebAssembly in Edge Functions.'
|
||||
---
|
||||
|
||||
Edge Functions supports running [WebAssembly (Wasm)](https://developer.mozilla.org/en-US/docs/WebAssembly) modules. WebAssembly is useful if you want to optimize code that's slower to run in JavaScript or require low-level manipulation.
|
||||
|
||||
It also gives you the option to port existing libraries written in other languages to be used with JavaScript. For example, [MagickWasm](https://supabase.com/docs/guides/functions/examples/image-manipulation), which does image manipulation and transforms, is a port of an existing C library to WebAssembly.
|
||||
|
||||
### Writing a Wasm module
|
||||
|
||||
You can use different languages and SDKs to write Wasm modules. For this tutorial, we will write a simple Wasm module in Rust that adds two numbers.
|
||||
|
||||
Follow this [guide on writing Wasm modules in Rust](https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_Wasm) to setup your dev environment.
|
||||
|
||||
Create a new Edge Function called `wasm-add`.
|
||||
|
||||
```bash
|
||||
supabase functions new wasm-add
|
||||
```
|
||||
|
||||
Create a new Cargo project for the Wasm module inside the function's directory:
|
||||
|
||||
```bash
|
||||
cd supabase/functions/wasm-add
|
||||
cargo new --lib add-wasm
|
||||
```
|
||||
|
||||
Add the following code to `add-wasm/src/lib.rs`.
|
||||
|
||||
<$CodeSample
|
||||
path="edge-functions/supabase/functions/wasm-modules/add-wasm/src/lib.rs"
|
||||
lines={[[1, -1]]}
|
||||
meta="lib.rs"
|
||||
/>
|
||||
|
||||
Update the `add-wasm/Cargo.toml` to include the `wasm-bindgen` dependency.
|
||||
|
||||
<$CodeSample
|
||||
path="edge-functions/supabase/functions/wasm-modules/add-wasm/Cargo.toml"
|
||||
lines={[[1, -1]]}
|
||||
meta="Cargo.toml"
|
||||
/>
|
||||
|
||||
After that we can build the package, by running:
|
||||
|
||||
```bash
|
||||
wasm-pack build --target deno
|
||||
```
|
||||
|
||||
This will produce a Wasm binary file inside `add-wasm/pkg` directory.
|
||||
|
||||
### Calling the Wasm module from the Edge Function
|
||||
|
||||
Now let's update the Edge Function to call `add` from the Wasm module.
|
||||
|
||||
<$CodeSample
|
||||
path="edge-functions/supabase/functions/wasm-modules/index.ts"
|
||||
lines={[[1, -1]]}
|
||||
meta="index.ts"
|
||||
/>
|
||||
|
||||
<Admonition type="info">
|
||||
Supabase Edge Functions currently use Deno 1.46. From [Deno 2.1, importing Wasm
|
||||
modules](https://deno.com/blog/v2.1) will require even less boilerplate code.
|
||||
</Admonition>
|
||||
|
||||
### Bundle and deploy the Edge Function
|
||||
|
||||
Before deploying the Edge Function, we need to ensure it bundles the Wasm module with it. We can do this by defining it in the `static_files` for the function in `superbase/config.toml`.
|
||||
|
||||
<Admonition type="info">
|
||||
You will need update Supabase CLI to 2.7.0 or higher for the `static_files` support.
|
||||
</Admonition>
|
||||
|
||||
```toml
|
||||
[functions.wasm-add]
|
||||
static_files = [ "./functions/wasm-add/add-wasm/pkg/*.wasm"]
|
||||
```
|
||||
|
||||
Deploy the function by running:
|
||||
|
||||
```bash
|
||||
supabase functions deploy wasm-add
|
||||
```
|
||||
@@ -8,14 +8,8 @@ hideToc: true
|
||||
<StepHikeCompact>
|
||||
|
||||
<StepHikeCompact.Step step={1}>
|
||||
|
||||
<QuickstartDbSetup />
|
||||
|
||||
</StepHikeCompact.Step>
|
||||
|
||||
<StepHikeCompact.Step step={2}>
|
||||
|
||||
<StepHikeCompact.Details title="Create a React app">
|
||||
<StepHikeCompact.Details title="Create a Hono app">
|
||||
|
||||
Boostrap the Hono example app from the Supabase Samples using the CLI.
|
||||
|
||||
@@ -31,7 +25,7 @@ hideToc: true
|
||||
|
||||
</StepHikeCompact.Step>
|
||||
|
||||
<StepHikeCompact.Step step={3}>
|
||||
<StepHikeCompact.Step step={2}>
|
||||
<StepHikeCompact.Details title="Install the Supabase client library">
|
||||
|
||||
The `package.json` file in the project includes the necessary dependencies, including `@supabase/supabase-js` and `@supabase/ssr` to help with server-side auth.
|
||||
@@ -48,7 +42,7 @@ hideToc: true
|
||||
|
||||
</StepHikeCompact.Step>
|
||||
|
||||
<StepHikeCompact.Step step={4}>
|
||||
<StepHikeCompact.Step step={3}>
|
||||
<StepHikeCompact.Details title="Set up the required environment variables">
|
||||
|
||||
Copy the `.env.example` file to `.env` and update the values with your Supabase project URL and anon key.
|
||||
@@ -70,11 +64,13 @@ hideToc: true
|
||||
|
||||
</StepHikeCompact.Step>
|
||||
|
||||
<StepHikeCompact.Step step={5}>
|
||||
<StepHikeCompact.Step step={4}>
|
||||
<StepHikeCompact.Details title="Start the app">
|
||||
|
||||
Start the app, go to http://localhost:5173.
|
||||
|
||||
Learn how [server side auth](/docs/guides/auth/server-side/creating-a-client?queryGroups=framework&framework=hono) works with Hono.
|
||||
|
||||
</StepHikeCompact.Details>
|
||||
|
||||
<StepHikeCompact.Code>
|
||||
|
||||
@@ -63,7 +63,7 @@ hideToc: true
|
||||
|
||||
```bash .env
|
||||
DB_CONNECTION=pgsql
|
||||
DATABASE_URL=postgres://postgres.xxxx:password@xxxx.pooler.supabase.com:5432/postgres
|
||||
DB_URL=postgres://postgres.xxxx:password@xxxx.pooler.supabase.com:5432/postgres
|
||||
```
|
||||
|
||||
</StepHikeCompact.Code>
|
||||
@@ -84,13 +84,13 @@ hideToc: true
|
||||
```php app/config/database.php
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'laravel',
|
||||
|
||||
+20
-20
@@ -17,23 +17,23 @@ Scopes are set when you [create an OAuth app](/docs/guides/platform/oauth-apps/b
|
||||
|
||||
## Available scopes
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Auth` | `Read` | Retrieve a project's auth configuration<br/>Retrieve a project's SAML SSO providers |
|
||||
| `Auth` | `Write` | Update a project's auth configuration<br/>Create, update, or delete a project's SAML SSO providers |
|
||||
| `Database` | `Read` | Retrieve the database configuration<br/>Retrieve SQL snippets<br/>Check if the database is in read-only mode<br/>Retrieve a database's SSL enforcement configuration<br/>Retrieve a database's schema typescript types |
|
||||
| `Database` | `Write` | Create a SQL query<br/>Enable database webhooks on the project<br/>Update the project's database configuration<br/>Update a database's SSL enforcement configuration<br/>Disable read-only mode for 15mins<br/>Retrieve the pooler configuration<br/>Create a PITR backup for a database |
|
||||
| `Domains` | `Read` | Retrieve the custom domains for a project<br/>Retrieve the vanity subdomain configuration for a project |
|
||||
| `Domains` | `Write` | Activate, initialize, reverify, or delete the custom domain for a project<br/>Activate, delete or check the availability of a vanity subdomain for a project |
|
||||
| `Edge Functions` | `Read` | Retrieve information about a project's edge functions |
|
||||
| `Edge Functions` | `Write` | Create, update, or delete an edge function |
|
||||
| `Environment` | `Read` | Retrieve branches in a project |
|
||||
| `Environment` | `Write` | Create, update, or delete a branch |
|
||||
| `Organizations` | `Read` | Retrieve an organization's metadata<br/>Retrieve all members in an organization |
|
||||
| `Organizations` | `Write` | Create an organization |
|
||||
| `Projects` | `Read` | Retrieve a project's metadata<br/>Check if a project's database is eligible for upgrade<br/>Retrieve a project's network restrictions<br/>Retrieve a project's network bans |
|
||||
| `Projects` | `Write` | Create a project<br/>Upgrade a project's database<br/>Remove a project's network bans<br/>Update a project's network restrictions |
|
||||
| `Rest` | `Read` | Retrieve a project's PostgREST configuration |
|
||||
| `Rest` | `Write` | Update a project's PostgREST configuration |
|
||||
| `Secrets` | `Read` | Retrieve a project's API keys<br/>Retrieve a project's secrets<br/>Retrieve a project's pgsodium config |
|
||||
| `Secrets` | `Write` | Create or update a project's secrets<br/>Update a project's pgsodium configuration |
|
||||
| Name | Type | Description |
|
||||
| ---------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Auth` | `Read` | Retrieve a project's auth configuration<br/>Retrieve a project's SAML SSO providers |
|
||||
| `Auth` | `Write` | Update a project's auth configuration<br/>Create, update, or delete a project's SAML SSO providers |
|
||||
| `Database` | `Read` | Retrieve the database configuration<br/>Retrieve the pooler configuration<br/>Retrieve SQL snippets<br/>Check if the database is in read-only mode<br/>Retrieve a database's SSL enforcement configuration<br/>Retrieve a database's schema typescript types |
|
||||
| `Database` | `Write` | Create a SQL query<br/>Enable database webhooks on the project<br/>Update the project's database configuration<br/>Update the pooler configuration<br/>Update a database's SSL enforcement configuration<br/>Disable read-only mode for 15mins<br/>Create a PITR backup for a database |
|
||||
| `Domains` | `Read` | Retrieve the custom domains for a project<br/>Retrieve the vanity subdomain configuration for a project |
|
||||
| `Domains` | `Write` | Activate, initialize, reverify, or delete the custom domain for a project<br/>Activate, delete or check the availability of a vanity subdomain for a project |
|
||||
| `Edge Functions` | `Read` | Retrieve information about a project's edge functions |
|
||||
| `Edge Functions` | `Write` | Create, update, or delete an edge function |
|
||||
| `Environment` | `Read` | Retrieve branches in a project |
|
||||
| `Environment` | `Write` | Create, update, or delete a branch |
|
||||
| `Organizations` | `Read` | Retrieve an organization's metadata<br/>Retrieve all members in an organization |
|
||||
| `Organizations` | `Write` | Create an organization |
|
||||
| `Projects` | `Read` | Retrieve a project's metadata<br/>Check if a project's database is eligible for upgrade<br/>Retrieve a project's network restrictions<br/>Retrieve a project's network bans |
|
||||
| `Projects` | `Write` | Create a project<br/>Upgrade a project's database<br/>Remove a project's network bans<br/>Update a project's network restrictions |
|
||||
| `Rest` | `Read` | Retrieve a project's PostgREST configuration |
|
||||
| `Rest` | `Write` | Update a project's PostgREST configuration |
|
||||
| `Secrets` | `Read` | Retrieve a project's API keys<br/>Retrieve a project's secrets<br/>Retrieve a project's pgsodium config |
|
||||
| `Secrets` | `Write` | Create or update a project's secrets<br/>Update a project's pgsodium configuration |
|
||||
@@ -59,6 +59,7 @@ The table below shows the actions each role can take on the resources belonging
|
||||
| <a href="#org-permissions" id="org-permissions">**Organization**</a> | | | | | |
|
||||
| Organization Management | Update | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
| | Delete | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
| OpenAI Telemetry Configuration[^2] | Update | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
| <a href="#member-permissions" id="member-permissions">**Members**</a> | | | | | |
|
||||
| Organization Members | List | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> |
|
||||
| Owner | Add | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
@@ -75,7 +76,7 @@ The table below shows the actions each role can take on the resources belonging
|
||||
| | Remove | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
| Invite | Revoke | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
| | Resend | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
| | Accept[^2] | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> |
|
||||
| | Accept[^3] | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> |
|
||||
| <a href="#billing-permissions" id="billing-permissions">**Billing**</a> | | | | | |
|
||||
| Invoices | List | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> |
|
||||
| Billing Email | View | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> |
|
||||
@@ -115,7 +116,7 @@ The table below shows the actions each role can take on the resources belonging
|
||||
|
||||
The table below shows the actions each role can take on the resources belonging to the project.
|
||||
|
||||
| Resource | Action | Owner | Admin | Developer | Read-Only[^3][^5] |
|
||||
| Resource | Action | Owner | Admin | Developer | Read-Only[^4][^6] |
|
||||
| ------------------------------------------------------------------------------------------------------ | ---------------------- | :-------------------------------------: | :-------------------------------------: | :-------------------------------------: | :-------------------------------------------------------------: |
|
||||
| <a href="#project-permissions" id="project-permissions">**Project**</a> | | | | | |
|
||||
| Project Management | Transfer | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
@@ -179,7 +180,7 @@ The table below shows the actions each role can take on the resources belonging
|
||||
| | Create | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
| | Delete | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
| <a href="#edge-config-permissions" id="edge-config-permissions">**Edge Functions Configuration**</a> | | | | | |
|
||||
| Secrets | View | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck className="inline" size={14} color="#3FCF8E" /> [^4] |
|
||||
| Secrets | View | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck className="inline" size={14} color="#3FCF8E" /> [^5] |
|
||||
| | Create | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
| | Delete | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> | <IconX size={14} /> |
|
||||
| <a href="#sql-editor-permissions" id="sql-editor-permissions">**SQL Editor**</a> | | | | | |
|
||||
@@ -188,7 +189,7 @@ The table below shows the actions each role can take on the resources belonging
|
||||
| | Delete | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> |
|
||||
| | View | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> |
|
||||
| | List | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> |
|
||||
| | Run | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck className="inline" size={14} color="#3FCF8E" /> [^6] |
|
||||
| | Run | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck className="inline" size={14} color="#3FCF8E" /> [^7] |
|
||||
| <a href="#database-permissions" id="database-permissions">**Database**</a> | | | | | |
|
||||
| Scheduled Backups | View | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> |
|
||||
| | Download | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconX size={14} /> |
|
||||
@@ -258,8 +259,9 @@ The table below shows the actions each role can take on the resources belonging
|
||||
| | List | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> | <IconCheck size={14} color="#3FCF8E" /> |
|
||||
|
||||
[^1]: Available on the Team and Enterprise Plans.
|
||||
[^2]: Invites sent from a SSO account can only be accepted by another SSO account coming from the same identity provider. This is a security measure that prevents accidental invites to accounts not managed by your company's enterprise systems.
|
||||
[^3]: Available on the Enterprise Plan.
|
||||
[^4]: Read-Only role is able to access secrets.
|
||||
[^5]: Listed permissions are for the API and Dashboard.
|
||||
[^6]: Limited to executing SELECT queries. SQL Query Snippets run by the Read-Only role are run against the database using the **supabase_read_only_user**. This role has the [predefined Postgres role pg_read_all_data](https://www.postgresql.org/docs/current/predefined-roles.html).
|
||||
[^2]: Sending anonymous data to OpenAI is opt in and can improve Studio AI Assistant's responses.
|
||||
[^3]: Invites sent from a SSO account can only be accepted by another SSO account coming from the same identity provider. This is a security measure that prevents accidental invites to accounts not managed by your company's enterprise systems.
|
||||
[^4]: Available on the Enterprise Plan.
|
||||
[^5]: Read-Only role is able to access secrets.
|
||||
[^6]: Listed permissions are for the API and Dashboard.
|
||||
[^7]: Limited to executing SELECT queries. SQL Query Snippets run by the Read-Only role are run against the database using the **supabase_read_only_user**. This role has the [predefined Postgres role pg_read_all_data](https://www.postgresql.org/docs/current/predefined-roles.html).
|
||||
@@ -160,13 +160,17 @@ Visa, Mastercard, American Express, Japan Credit Bureau (JCB), China UnionPay (C
|
||||
|
||||
#### What currency can I pay in?
|
||||
|
||||
All our invoices are issued in USD, but you can pay in any currency as long as your credit card provider allows charging in USD after conversion.
|
||||
All our invoices are issued in USD, but you can pay in any currency so long as the credit card provider allows charging in USD after conversion.
|
||||
|
||||
#### Can I change the payment method?
|
||||
|
||||
Yes, you will have to add the new payment method before being allowed to remove the old one.
|
||||
This can be done from your dashboard on the [organization’s billing page](https://supabase.com/dashboard/org/_/billing).
|
||||
|
||||
#### Can I pay upfront for multilpe months?
|
||||
|
||||
You can top up your credit balance to cover multiple months through your [organization’s billing page](https://supabase.com/dashboard/org/_/billing).
|
||||
|
||||
#### When are payments taken?
|
||||
|
||||
Payments are taken at the beginning of each billing cycle. You will be charged once a month. You can see the current billing cycle and upcoming invoice in your [organization's billing settings](https://supabase.com/dashboard/org/_/billing). The subscription plan, custom domain and PITR addons are charged upfront, whereas usage-charges, including compute, are charged in hindsight based on your usage.
|
||||
|
||||
@@ -155,9 +155,9 @@ You can see a breakdown of the different types of egress on your [organization u
|
||||
|
||||
## Disk size
|
||||
|
||||
We differentiate between database space usage and disk size. Database Space is the actual amount of space used by all your database objects, whereas disk size is the size of the underlying provisioned disk. Each database has a provisioned disk.
|
||||
We differentiate between database size and disk size. Database size is the actual amount of space used by all your database objects, whereas disk size is the size of the underlying provisioned disk. Each database has a provisioned disk.
|
||||
|
||||
Free Plan customers are limited to 500 MB of database space.
|
||||
Free Plan customers are limited to 500 MB of database size per project.
|
||||
|
||||
For paid plan customers:
|
||||
|
||||
@@ -189,7 +189,7 @@ Here are the quotas for the Free Plan:
|
||||
| Usage Item | Free Plan |
|
||||
| ------------------------- | ----------------------------- |
|
||||
| Egress | 5GB across Database + Storage |
|
||||
| Database Space | 500MB |
|
||||
| Database Size | 500MB |
|
||||
| Storage Space | 1GB |
|
||||
| Monthly Active Users | 50,000 MAU |
|
||||
| Edge Function Invocations | 500K |
|
||||
|
||||
@@ -107,17 +107,9 @@ If you upgrade to a paid plan while your project is paused, any expired one-clic
|
||||
[Migrating within Supabase guide](/docs/guides/platform/migrating-within-supabase)
|
||||
</Admonition>
|
||||
|
||||
If the 90 day project restore window has expired but you need to access data contained within your project using SQL, you can attempt to restore the project into a local Postgres instance. Supabase publishes tooling that can be used for that purpose. Be aware that this workflow does not produce a complete Supabase environment with REST/Auth/Storage. Instead, it creates a standalone Postgres instance that is maximally compatible with your project's backup file to assist with recovering your data.
|
||||
If the 90 day project restore window has expired but you need to access data contained within your project using SQL, you can use the [Supabase CLI](/docs/guides/local-development) to restore the project into a local Postgres instance.
|
||||
|
||||
Downloaded backups are plain text SQL files that can be executed in Postgres to restore your project's schema and data. If you need to access data within a backup we recommend restoring into a Postgres instance built using the Supabase open source build tooling to ensure that the local instance is as similar to the original project as possible. Here are the steps to start Supabase Postgres locally and restore the backup:
|
||||
|
||||
Install [nix](https://nixos.org/):
|
||||
|
||||
```sh
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
||||
```
|
||||
|
||||
To identify your project's backup image version, reference the backup's download button following the `PG:` prefix:
|
||||
First, download your project's backup file from dashboard and identify its backup image version (following the `PG:` prefix):
|
||||
|
||||
<Image
|
||||
zoomable
|
||||
@@ -125,33 +117,30 @@ To identify your project's backup image version, reference the backup's download
|
||||
src="/docs/img/guides/platform/paused-dl-image-version.png"
|
||||
/>
|
||||
|
||||
Given Postgres version `15.6.1.115`, start Postgres locally with the nix command:
|
||||
Given Postgres version `15.6.1.115`, start Postgres locally with `db_cluster.backup` being the path to your backup file.
|
||||
|
||||
```sh
|
||||
nix run 'github:supabase/postgres?ref=15.6.1.115#start-server' 15
|
||||
supabase init
|
||||
echo '15.6.1.115' > supabase/.temp/postgres-version
|
||||
supabase db start --from-backup db_cluster.backup
|
||||
```
|
||||
|
||||
where `15` refers to the backup's Postgres major version.
|
||||
Note that the earliest Supabase Postgres version that supports a local restore is `15.1.0.55`. If your hosted project was running on earlier versions, you will likely run into errors during restore. Before submitting any support ticket, make sure you have attached the error logs from `supabase_db_*` docker container.
|
||||
|
||||
Note that the earliest Supabase Postgres version that supports a direct reference is `15.6.1.115`. If you don't know your project's Postgres version or it is lower than `15.6.1.115` then omit the `ref` option to build our most recent image:
|
||||
Once your local database starts up successfully, you can connect using psql to verify that all your data is restored.
|
||||
|
||||
```sh
|
||||
nix run 'github:supabase/postgres#start-server' -- 15
|
||||
psql 'postgresql://postgres:postgres@localhost:54322/postgres'
|
||||
```
|
||||
|
||||
Then restore the backup file from a separate shell session:
|
||||
If you want to use other services like Auth, Storage, and Studio dashboard together with your restored database, restart the local development stack.
|
||||
|
||||
```sh
|
||||
nix run github:supabase/postgres#start-client -- --file <BACKUP FILE>
|
||||
supabase stop
|
||||
supabase start
|
||||
```
|
||||
|
||||
Which loads the backup into Postgres and drops you into a [psql](https://www.postgresql.org/docs/current/app-psql.html) prompt. For `start-client` you do not need to provide a reference to the backup's Postgres version.
|
||||
|
||||
Once your project has been restored, connect to it with your preferred Postgres tooling using `host=localhost`, `user=postgres`, `port=5432`, and an empty password. This will allow you to inspect your saved data and export whatever is necessary.
|
||||
|
||||
Errors encountered during the restore process are logged to the console by the `start-server` process. Review those errors and edit the backup file as needed until the project restores successfully. The backup file is a plain text sequence of SQL statements that recreate your database. To resolve common error classes like `relation "xxx" does not exist`, identify the line raising the exception and shuffle the `create ... "xxx"` statement before it. A failed restore leaves artifacts on the Postgres server so be sure to restart the `start-server` process between restore attempts.
|
||||
|
||||
A Postgres database started with `start-server` command is not production ready and should never be used outside a local development workflow.
|
||||
A Postgres database started with Supabase CLI is not production ready and should not be used outside of local development.
|
||||
|
||||
#### Disk sizing
|
||||
|
||||
|
||||
@@ -224,6 +224,35 @@ You can provide a callback for the `broadcast` channel to receive message. This
|
||||
})
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
<TabPanel id="js-async" label="Async JavaScript">
|
||||
|
||||
We can send Broadcast messages using `channelB.send()`. Let's set up another client to send messages.
|
||||
|
||||
We can wrap the subscription in a promise to use async/await.
|
||||
|
||||
{/* prettier-ignore */}
|
||||
```js
|
||||
// Join a room/topic. Can be anything except for 'realtime'.
|
||||
const channelB = supabase.channel('room-1')
|
||||
|
||||
const channelSubscribed = await new Promise((resolve, reject) => {
|
||||
channelB.subscribe((status) => {
|
||||
if (status === 'SUBSCRIBED') {
|
||||
resolve(channel);
|
||||
} else {
|
||||
reject("Could not subscribe to channel");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
channelSubscribed.send({
|
||||
type: 'broadcast',
|
||||
event: 'test',
|
||||
payload: { message: 'hello, world' },
|
||||
});
|
||||
```
|
||||
|
||||
</TabPanel>
|
||||
<TabPanel id="dart" label="Dart">
|
||||
|
||||
|
||||
@@ -32,6 +32,6 @@ on storage.objects
|
||||
for delete
|
||||
TO authenticated
|
||||
USING (
|
||||
owner = (select auth.uid())
|
||||
owner = (select auth.uid()::text)
|
||||
);
|
||||
```
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title = "42501 : permission denied for table http_request_queue"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21450"
|
||||
date_created = "2024-02-22T10:26:29+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "permission", "pg_net", "http_request_queue" ]
|
||||
database_id = "97923126-7d0b-4bf0-bb65-55dae289a8a3"
|
||||
|
||||
[[errors]]
|
||||
code = "42501"
|
||||
message = "permission denied for table http_request_queue"
|
||||
---
|
||||
|
||||
If you're currently blocked by the above error, please run the following in your Supabase SQL editor:
|
||||
|
||||
- Check `select * from net.http_request_queue` and make sure it's empty.
|
||||
- Try `drop extension pg_net; create extension pg_net schema extensions;`
|
||||
- If that doesn't work (e.g. because some objects depend on it), then please [contact support](https://supabase.com/support).
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title = "All about Supabase Egress"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/26605"
|
||||
date_created = "2024-05-21T11:52:49+00:00"
|
||||
topics = [ "platform", "database", "functions", "storage", "realtime", "auth", "supavisor" ]
|
||||
keywords = [ "egress", "bandwidth" ]
|
||||
database_id = "ba593989-12b5-464f-8ede-a525e1ca2ffb"
|
||||
---
|
||||
|
||||
**What is Egress?**
|
||||
|
||||
Egress (also known as bandwidth) is any amount of network packets/bytes being streamed back to a connected client. Means, the data that is leaving the Supabase platform. Egress in Supabase includes any calls through PostgREST, to Storage, Realtime, Auth, Edge Functions, Database and Supavisor.
|
||||
|
||||
You can read about Unified egress, included quota, and how to check the egress usage here: https://supabase.com/docs/guides/platform/org-based-billing#unified-egress. Additionally, the [project reports](https://supabase.com/dashboard/project/_/reports) have a few egress related stats. You can create a custom report to look into daily egress.
|
||||
|
||||
- Example: Log Explorer -> Custom Reports -> Add/Remove charts -> Database API -> API Egress.
|
||||
|
||||
**What is contributing to Egress?**
|
||||
|
||||
While pointing out the exact cause for egress may not be straightforward, there are various steps you can take to determine the source of these issues:
|
||||
|
||||
- Picking the "Top Paths" from the [log explorer](https://app.supabase.com/project/_/logs/explorer/templates) will help you identify heavily queried paths
|
||||
- By finding the most requested queries from Query performance report: https://app.supabase.com/project/_/reports/query-performance
|
||||
- Supavisor Egress is independent of client. There is no direct relation between a single query and Supavisor egress, it is harder to debug and identify. But you can make use of frequent queries from the link in above step that also displays average number of rows which will help to identify queries with a large number of rows returned. While this does not display Supavisor queries specifically, it will give an overview of queries with lots of rows that can help.
|
||||
- For Storage Egress, all outgoing traffic for storage-related requests to download/view your Storage items are considered as Storage egress. We have a "Storage Egress Requests" template in logs explorer that you can use to get the number of requests for each Storage object
|
||||
- If you pull 1mb of data out of the database using the Supavisor connection in your edge function, but only sends 100kb back to the user, you will have the Egress from the Supavisor to your Edge function plus from the edge function to your user
|
||||
|
||||
**How can you decrease egress?**
|
||||
|
||||
- Reduce the number of fields selected or entries when querying
|
||||
- Reduce the number of queries/calls by optimising client code or use caches to reduce the number of requests/queries being done: https://github.com/psteinroe/supabase-cache-helpers/
|
||||
- In case of update/insert queries, if you don’t need the entire row to be returned, configure your ORM/queries to not return the entire row
|
||||
- In case of running manual backups through Supavisor, remove unneeded tables and/or reduce the frequency
|
||||
- For Storage, if you start using the [smartCDN](https://supabase.com/docs/guides/storage/cdn/smart-cdn) Storage Egress usage can be managed. You can also use the [Supabase Image Transformations](https://supabase.com/docs/guides/storage/image-transformations) to optimize the images and reduce the egress.
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title = "An \"invalid response was received from the upstream server\" error when querying auth"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/20722"
|
||||
date_created = "2024-01-25T07:08:43+00:00"
|
||||
topics = [ "auth" ]
|
||||
database_id = "7183351e-dba3-484d-83b3-bb89a027e36a"
|
||||
|
||||
[[errors]]
|
||||
message = "invalid response was received from the upstream server"
|
||||
|
||||
[[errors]]
|
||||
message = "running db migrations: error executing migrations/20221208132122_backfill_email_last_sign_in_at.up.sql"
|
||||
|
||||
[[errors]]
|
||||
message = "operator does not exist: uuid = text"
|
||||
---
|
||||
|
||||
If you are observing an "invalid response was received from the upstream server" error when making requests to Supabase Auth, it could mean that the respective service is down. One way to confirm this is to visit the [logs explorer](https://supabase.com/dashboard/project/_/logs/explorer) and look at the auth logs to see if there are any errors with the following lines:
|
||||
|
||||
- `running db migrations: error executing migrations/20221208132122_backfill_email_last_sign_in_at.up.sql`
|
||||
|
||||
We're currently investigating an issue where the tables responsible for keeping track of migrations ran by Auth (`auth.schema_migrations`) are not being restored properly, which leads to the service(s) retrying those migrations. In such cases, migrations which are not idempotent will run into issues.
|
||||
|
||||
We've documented some of the migrations that run into this issue and their corresponding fix here:
|
||||
|
||||
### Auth: `operator does not exist: uuid = text`
|
||||
|
||||
Temporary fix: Run `insert into auth.schema_migrations values ('20221208132122');` via the [sql editor](https://supabase.com/dashboard/project/_/sql/new) to fix the issue.
|
||||
|
||||
If the migration error you're seeing looks different, please reach out to [supabase.help](https://supabase.help/) for assistance.
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title = "Are all features available in self-hosted Supabase?"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/27299"
|
||||
date_created = "2024-06-16T09:33:39+00:00"
|
||||
topics = [ "self-hosting" ]
|
||||
database_id = "03854567-8838-4f12-8a6c-095fc1671d9f"
|
||||
---
|
||||
|
||||
### Overview
|
||||
|
||||
The self-hosted version is pretty similar to the hosted one. It might not always have the latest features right away, but it includes everything you need to get your application up and running.
|
||||
|
||||
### Feature availability
|
||||
|
||||
To know what features are available in the self-hosted version, refer to the comprehensive list here:
|
||||
[Supabase Features](https://supabase.com/docs/guides/getting-started/features#generally-available)
|
||||
|
||||
### Self-hosting documentation
|
||||
|
||||
For detailed steps and guidance on how to set up and manage your self-hosted Supabase instance, follow the documentation provided:
|
||||
[Self-Hosting Guide](https://supabase.com/docs/guides/self-hosting)
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title = "Auth error: {401: invalid claim: missing sub}"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21347"
|
||||
date_created = "2024-02-18T13:47:37+00:00"
|
||||
topics = [ "auth" ]
|
||||
keywords = [ "JWT", "Server-Side Rendering" ]
|
||||
database_id = "e90ca9e0-0376-4313-b32b-b9a4ae81bf7a"
|
||||
|
||||
[api]
|
||||
sdk = [ "auth-getuser" ]
|
||||
|
||||
[[errors]]
|
||||
http_status_code = 401
|
||||
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.
|
||||
|
||||
**Why Does This Happen?**
|
||||
|
||||
- The Supabase API keys are designed for different purposes and, while they are recognized by the Supabase Auth system, they do not carry the sub claim. The sub claim is essential as it encodes the user ID, which is a mandatory field for authentication processes. This mistake leads to the "missing sub claim" error because the system expects a token that contains user identification information.
|
||||
|
||||
**How to Avoid This Issue:**
|
||||
|
||||
- Ensure that the token being passed to supabase.auth.getUser() is, indeed, an Auth access token and not one of the API keys.
|
||||
|
||||
- Are you creating the client on a per-request basis or are you creating a global client to be shared? If you're creating the client on a per-request basis, then you need to pass the session with the user's JWT from the client to the server somehow. This can be done by sending the user's JWT in a header like an `Authorization: Bearer <user_jwt>` . You can then get this header and call supabase.auth.getUser(user_jwt) with the user's JWT.
|
||||
|
||||
- Examine how the Supabase client is being initialized, especially in server-side scenarios.
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
---
|
||||
title = "Avoiding timeouts in long running queries"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21133"
|
||||
date_created = "2024-02-09T02:46:42+00:00"
|
||||
topics = [ "database", "platform" ]
|
||||
keywords = [ "timeout", "query", "database", "psql", "compute" ]
|
||||
database_id = "8bb130d5-d298-49c7-8cfb-dd7a3f231154"
|
||||
---
|
||||
|
||||
<Admonition type="tip">
|
||||
|
||||
This page covers long-running queries via the Dashboard or external interfaces. For Supabase Client API timeout errors, check this [guide](https://github.com/orgs/supabase/discussions/14256) instead.
|
||||
|
||||
</Admonition>
|
||||
|
||||
Certain queries, like indexing a table or changing a column's data type, are inherently time-consuming. The [Dashboard's SQL Editor](https://supabase.com/dashboard/project/_/sql/) has a 1-minute timeout limit.
|
||||
|
||||
To execute long-running queries, follow the below steps.
|
||||
|
||||
### Install an external SQL client
|
||||
|
||||
The guide focuses on [psql](https://supabase.com/docs/guides/database/psql) but you can use any Postgres client.
|
||||
|
||||
Some other options include:
|
||||
|
||||
- [pgadmin](https://supabase.com/docs/guides/database/pgadmin)
|
||||
- [DBeaver](https://supabase.com/docs/guides/database/dbeaver)
|
||||
|
||||
You can install PSQL in [macOS](https://stackoverflow.com/a/49689589/2188186) and [Windows](https://www.postgresql.org/download/windows/) by following these links and instructions. For Linux (Debian) you can run the following:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install postgresql-client
|
||||
```
|
||||
|
||||
Once installed, you can find your PSQL string in the [Database Settings](https://supabase.com/dashboard/project/_/settings/database). Please make sure if you are using the pooler connection that it is in session mode (port 5432).
|
||||
|
||||
<Admonition type="tip">
|
||||
|
||||
If you are working in an [IPv6 environment](https://github.com/orgs/supabase/discussions/27034) or have the IPv4 Add-On, it is preferable to use the direct connection.
|
||||
|
||||
</Admonition>
|
||||
|
||||
### Increase the query timeout
|
||||
|
||||
Then you can increase the query timeout solely for your session:
|
||||
|
||||
Long timeout
|
||||
|
||||
```sql
|
||||
set statement_timeout = '120min';
|
||||
```
|
||||
|
||||
Disable timeout
|
||||
|
||||
```sql
|
||||
set statement_timeout = '0';
|
||||
```
|
||||
|
||||
If your task is particularly long, you can may want to consider boosting your computing power temporarily. Compute size on Supabase is charged by the hour, so you can increase it for an hour or two, complete your task faster, then scale it back afterward.
|
||||
|
||||
If you want to temporarily upgrade, you can find the add-ons for your project in your [Dashboard's Add-Ons Settings.](https://supabase.green/dashboard/project/_/settings/addons)
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title = "Canceling statement due to \"statement timeout\""
|
||||
github_url = "https://github.com/orgs/supabase/discussions/14256"
|
||||
date_created = "2023-05-10T08:29:05+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "statement", "timeout", "postgres", "performance" ]
|
||||
database_id = "4a41e734-6883-452f-bc8e-82ff4ac22a81"
|
||||
---
|
||||
|
||||
> If encountering 504 or timeout errors in the Dashboard, check out this [guide](https://github.com/orgs/supabase/discussions/21133#discussioncomment-9573776)
|
||||
|
||||
You can run this query to check the current settings set for your roles: `SELECT rolname, rolconfig FROM pg_roles;`
|
||||
|
||||
To increase the `statement_timeout` for a specific role, you may follow the instructions [here](https://supabase.com/docs/guides/database/timeouts#changing-the-default-timeout). Note that it may require a quick reboot for the changes to take effect.
|
||||
|
||||
Additionally, to check how long a query is taking, you can check the Query Performance report which can give you more information on the query's performance: https://app.supabase.com/project/_/reports/query-performance. You can use the [query plan analyzer](https://www.postgresql.org/docs/current/sql-explain.html) on any expensive queries that you have identified: `explain analyze <query-statement-here>;`. For supabase-js/ postgREST queries you can use `.explain()`.
|
||||
|
||||
You can also make use of Postgres logs that will give you useful information like when the query was executed: https://app.supabase.com/project/_/logs/postgres-logs.
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
---
|
||||
title = "Certain operations are too complex to perform directly using the client libraries."
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21294"
|
||||
date_created = "2024-02-15T12:37:11+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "stored", "function", "complex" ]
|
||||
database_id = "df9518df-d019-42bb-8d91-918c6d57b452"
|
||||
---
|
||||
|
||||
**Solution**
|
||||
In cases where operations are overly complex or not feasible to implement directly using the client libraries, it might be beneficial to leverage stored functions within your database.
|
||||
|
||||
Follow these steps to create and run a stored function:
|
||||
|
||||
**Create the Stored Function:**
|
||||
|
||||
Go to the [SQL query editor](https://supabase.com/dashboard/project/_/sql/new) on your database dashboard.
|
||||
Run the following SQL script to create a stored function tailored to your specific complex query:
|
||||
|
||||
```
|
||||
DROP FUNCTION IF EXISTS get_my_complex_query;
|
||||
CREATE FUNCTION get_my_complex_query(parameter INT)
|
||||
RETURNS TABLE (column1 INTEGER, column2 VARCHAR, column3 DATE) AS
|
||||
$$
|
||||
BEGIN
|
||||
RETURN QUERY
|
||||
SELECT t1.column1, t1.column2, t2.column3
|
||||
FROM "TableName1" AS t1
|
||||
INNER JOIN "TableName2" AS t2 ON t1.column = t2.column
|
||||
INNER JOIN "TableName3" AS t3 ON t2.another_column = t3.another_column
|
||||
LEFT JOIN "TableName4" AS t4 ON t3.some_column = t4.some_column
|
||||
WHERE t2.column = parameter
|
||||
AND t3.column_name = 'some_value';
|
||||
END;
|
||||
$$
|
||||
LANGUAGE plpgsql VOLATILE;
|
||||
```
|
||||
|
||||
**Call the Stored Function:**
|
||||
|
||||
Use the supabase.rpc method to call the stored function from your application code. Replace "get_my_complex_query" with the appropriate function name and provide the necessary parameters:
|
||||
|
||||
```
|
||||
supabase.rpc("get_my_complex_query", { parameter: 1 })
|
||||
.then(response => {
|
||||
// Handle the response
|
||||
})
|
||||
.catch(error => {
|
||||
// Handle errors
|
||||
});
|
||||
```
|
||||
|
||||
**Further Resources:**
|
||||
|
||||
For more information on PostgreSQL database functions, refer to the following resource:
|
||||
[Supabase Stored Procedures](https://supabase.com/docs/guides/database/functions#quick-demo)
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title = "Change email associated with Supabase account"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21147"
|
||||
date_created = "2024-02-09T11:58:06+00:00"
|
||||
topics = [ "platform", "auth" ]
|
||||
keywords = [ "email", "account", "authentication" ]
|
||||
database_id = "6de3c3a9-8614-48d7-827e-cf41d6a1ce23"
|
||||
---
|
||||
|
||||
Currently, there isn't a direct way to change the email address of an existing Supabase account.
|
||||
|
||||
If you are using Email Authentication to login into your Supabase account:
|
||||
|
||||
- Invite a new email address to your Supabase Organization(s) as an Organization owner.
|
||||
- After signing up for a new account with your new email address and confirming you have access to the Organization(s) with your new account, you can leave the Organization(s) from your previous account.
|
||||
|
||||
If you are using Github Authentication to login into your Supabase account:
|
||||
|
||||
- Log out of Supabase.
|
||||
- Change Primary Email in GitHub
|
||||
- Log out of Github.
|
||||
- Log back into Github (with the new, desired email set as primary)
|
||||
- Log back into Supabase.
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title = "Change Project Region"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/16341"
|
||||
date_created = "2023-08-08T14:44:20+00:00"
|
||||
topics = [ "platform", "database", "auth" ]
|
||||
keywords = [ "region", "migration" ]
|
||||
database_id = "fd711d33-9703-402f-84b2-8e74034e7690"
|
||||
---
|
||||
|
||||
The process to change the region of a Supabase Project is to create a new project in the desired region and migrate your existing project to the new project using this guide: https://supabase.com/docs/guides/database#migrating-between-projects
|
||||
|
||||
If you are using third-party auth(Facebook, Google, etc.), you need to manually copy over your client id/secret pairs in the dashboard. Also, you'd need to change your API URL/Anon or Service Keys, which is usually done via ENV vars on your web host.
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title = "Check usage for monthly active users (MAU)"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/16965"
|
||||
date_created = "2023-08-29T12:30:52+00:00"
|
||||
topics = [ "auth", "platform" ]
|
||||
keywords = [ "MAU", "Monthly active users" ]
|
||||
database_id = "1759134d-a98d-4bfa-9501-71e06180700e"
|
||||
---
|
||||
|
||||
You can see the usage in your [projects usage page](https://app.supabase.com/project/_/settings/billing/usage).
|
||||
|
||||
For MAU, we rely on the [Auth Server](https://github.com/supabase/auth) logs. MAU count is relative to your billing cycle and resets whenever your billing cycle resets. You can check your Auth logs in your [projects logs & analytics section](https://supabase.com/dashboard/project/_/logs/auth-logs).
|
||||
|
||||
We do a distinct count of all user ids in the billing cycle. An Auth event can be a login, token refresh, logout, ... If an authenticated user does any of this, we count it towards the MAU. A user is only counted once towards MAU in a billing cycle.
|
||||
|
||||
The log retention for you as a user (accessible time) depends on your plan. Free plan users can access the logs of the last day, Pro plan users 7 days, Team plan users 28 days, Enterprise users 90 days. Unless you're on an Enterprise plan, you won't be able to execute the query to determine MAU yourself, as you don't have access to the logs in the past 30ish days (depending on your billing cycle).
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title = "Converted Github account to organization - Lost Supabase account access"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21101"
|
||||
date_created = "2024-02-08T01:39:25+00:00"
|
||||
topics = [ "auth" ]
|
||||
keywords = [ "github", "organization", "access" ]
|
||||
database_id = "94c6e33b-cc05-49b3-b010-7480f8dde843"
|
||||
---
|
||||
|
||||
[Converting](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-personal-account/converting-a-user-into-an-organization) your GitHub account to a [GitHub organization](https://docs.github.com/en/get-started/learning-about-github/types-of-github-accounts#organization-accounts) will cause you to lose access to all other accounts using GitHub sign-ins.
|
||||
|
||||
However, Supabase can help you transfer ownership of an existing organization on your account by inviting a new owner to your organization. This new user will need to have a different email from the previous one, and you will need to email support@supabase.com with that new email as well to confirm that you own the email address.
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
title = "Customizing Emails by Language"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21227"
|
||||
date_created = "2024-02-13T16:03:27+00:00"
|
||||
topics = [ "auth" ]
|
||||
keywords = [ "emails" ]
|
||||
database_id = "2ebc2849-0cf7-4c94-ac13-22167a196a92"
|
||||
---
|
||||
|
||||
When you register a user, you can create meta-data about them.
|
||||
|
||||
Creating meta-data with the JS-Client's [signUp function](https://supabase.com/docs/reference/javascript/auth-signup?example=sign-up-with-additional-user-metadata)
|
||||
|
||||
```javascript
|
||||
const { data, error } = await supabase.auth.signUp({
|
||||
email: 'email@some_[email.com](http://email.com/)',
|
||||
password: 'example-password',
|
||||
options: {
|
||||
data: {
|
||||
first_name: 'John',
|
||||
last_name: 'Doe',
|
||||
age: 27,
|
||||
},
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
The above example creates a user entry that includes information about their name and age. The data is stored in the auth.users table in the `auth.raw_user_meta_data` column. You can view it in the auth schema with the [SQL Editor](https://supabase.com/dashboard/project/_/editor).
|
||||
|
||||
It can be accessed in a project's [Email Templates](https://supabase.com/dashboard/project/_/auth/templates). Below is an example:
|
||||
|
||||

|
||||
|
||||
If you need to update a user's meta-data, you can do so with the [updateUser](https://supabase.com/docs/reference/javascript/auth-updateuser?example=update-the-users-metadata) function.
|
||||
|
||||
The meta-data can be used to store a users language preferences. You could then use "if statements" in the email template to set the response for a specific language:
|
||||
|
||||
```html
|
||||
{{if eq .Data.langauge "en" }}
|
||||
<h1>Welcome!</h1>
|
||||
{{ else if eq .Data.langauge "pl" }}
|
||||
<h1>Witamy!</h1>
|
||||
{{ else }}
|
||||
<h1>chuS'ugh, tera' je (Klingon)</h1>
|
||||
{{end}}
|
||||
```
|
||||
|
||||
Supabase uses the [Go Templating Language](https://pkg.go.dev/text/template) to render emails. It has advanced features for conditions that you may want to [explore](https://gohugo.io/templates/introduction/). For more examples, there is a [GitHub discussion](https://github.com/supabase/gotrue/issues/80#issuecomment-1552264148) that discusses advanced language templates.
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
title = "Dashboard errors when managing users"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21247"
|
||||
date_created = "2024-02-14T04:26:37+00:00"
|
||||
topics = [ "auth", "studio" ]
|
||||
keywords = [ "users" ]
|
||||
database_id = "c5d8260b-c17a-4f6c-ab20-801f953f6c94"
|
||||
|
||||
[api]
|
||||
sdk = [ "auth-signup" ]
|
||||
|
||||
[[errors]]
|
||||
message = "Failed to send magic link: failed to make magiclink request: Error sending magic link"
|
||||
|
||||
[[errors]]
|
||||
message = "Failed to delete user: Database error deleting user"
|
||||
|
||||
[[errors]]
|
||||
message = "Failed to create user: Database error creating new user"
|
||||
|
||||
[[errors]]
|
||||
http_status_code = 500
|
||||
message = "Database error saving new user"
|
||||
---
|
||||
|
||||
## PROBLEM
|
||||
|
||||
### Receiving the following or _similar_ error messages in the Dashboard when managing users.
|
||||
|
||||
> ... Database error
|
||||
> ... Error sending
|
||||
|
||||
<img
|
||||
width="243"
|
||||
src="https://github.com/supabase/supabase/assets/91111415/91732e7d-0e83-4bc8-8ce3-57ebd871d981"
|
||||
/>
|
||||
<img
|
||||
width="271"
|
||||
src="https://github.com/supabase/supabase/assets/91111415/30f4cd9f-3736-40ae-8606-2f060cfac0d0"
|
||||
/>
|
||||
<img
|
||||
width="271"
|
||||
src="https://github.com/supabase/supabase/assets/91111415/50961019-b461-44cb-9e4b-f1361aa3ad5d"
|
||||
/>
|
||||
|
||||
### Or, receiving a comparable 500 error from the Auth REST API:
|
||||
|
||||
> Database error ...
|
||||
|
||||
<img
|
||||
width="496"
|
||||
alt="Screenshot 2024-02-13 at 10 59 17 PM"
|
||||
src="https://github.com/supabase/supabase/assets/91111415/cd151dda-5160-415c-925c-cea332887641"
|
||||
/>
|
||||
|
||||
## SOLUTION 1 (trigger related)
|
||||
|
||||
Check if the auth schema contains any triggers in the [Dashboard's trigger section](https://supabase.com/dashboard/project/_/database/triggers). Remove all triggers by dropping their functions with a CASCADE modifier:
|
||||
|
||||
```sql
|
||||
DROP FUNCTION <function name>() CASCADE;
|
||||
|
||||
-- If you'd prefer, you can drop the trigger alone with the following query:
|
||||
-- DROP TRIGGER <trigger_name> on auth.<table_name>;
|
||||
```
|
||||
|
||||
Then recreate the functions with a [security definer](https://supabase.com/docs/guides/database/functions#security-definer-vs-invoker) modifier before recreating the triggers.
|
||||
|
||||
The [SQL Editor](https://supabase.com/dashboard/project/_/sql/) contains a template for [User Management](https://supabase.com/dashboard/project/_/sql/quickstarts). Within it, there is a working example of how to setup triggers with security definers that may be worth referencing:
|
||||
|
||||
```sql
|
||||
create table profiles (
|
||||
id uuid references auth.users on delete cascade not null primary key,
|
||||
updated_at timestamp with time zone,
|
||||
username text unique,
|
||||
full_name text,
|
||||
avatar_url text,
|
||||
website text,
|
||||
|
||||
constraint username_length check (char_length(username) >= 3)
|
||||
);
|
||||
|
||||
create function public.handle_new_user()
|
||||
returns trigger as $$
|
||||
begin
|
||||
insert into public.profiles (id, full_name, avatar_url)
|
||||
values (new.id, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'avatar_url');
|
||||
return new;
|
||||
end;
|
||||
$$ language plpgsql security definer;
|
||||
|
||||
create trigger on_auth_user_created
|
||||
after insert on auth.users
|
||||
for each row execute procedure public.handle_new_user();
|
||||
```
|
||||
|
||||
### EXPLANATION
|
||||
|
||||
One of the most common design patterns in Supabase is to add a trigger to the `auth.users` table. The database role managing authentication (supabase_auth_admin) only has the necessary permissions it needs to perform its duties. So, when a trigger operated by the supabase_auth_admin interacts outside the auth schema, it causes a permission error.
|
||||
|
||||
A security definer function retains the privileges of the database user that created it. As long as it is the `postgres` role, your auth triggers should be able to engage with outside tables.
|
||||
|
||||
## SOLUTION 2 (constraint related)
|
||||
|
||||
If you did not create a trigger, check if you created a foreign/primary key relationship between the auth.users table and another table. If you did, then ALTER the [behavior](https://stackoverflow.com/questions/5383612/setting-up-table-relations-what-do-cascade-set-null-and-restrict-do) of the relationship and recreate it with a less [restrictive constraint](https://stackoverflow.com/questions/3359329/how-to-change-the-foreign-key-referential-action-behavior).
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title = "Database Error: remaining connection slots are reserved for non-replication superuser connections"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/13995"
|
||||
date_created = "2023-04-27T10:39:24+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "connections", "connection slots", "reserved", "superuser" ]
|
||||
database_id = "b3a73631-0b8d-460d-8033-28df88d26d75"
|
||||
|
||||
[[errors]]
|
||||
message = "remaining connection slots are reserved for non-replication superuser connections"
|
||||
---
|
||||
|
||||
This error usually occurs when the database reaches the maximum number of connections allowed based on the compute add-on.
|
||||
|
||||
To overcome this, the connections need to be optimized as mentioned here: https://supabase.com/docs/guides/platform/performance#optimizing-the-number-of-connections
|
||||
|
||||
Additionally, you can try using the connection pool to help solve this issue:
|
||||
https://supabase.com/docs/guides/database/connecting-to-postgres#connection-pooler
|
||||
|
||||
If you're already using connection pooling and still hitting the maximum connections, then it is suggested to upgrade your compute add-on that allows more connections: https://supabase.com/docs/guides/platform/compute-add-ons
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title = "Database error saving new user"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/13043"
|
||||
date_created = "2023-03-16T04:52:50+00:00"
|
||||
topics = [ "auth", "studio" ]
|
||||
keywords = [ "users" ]
|
||||
database_id = "5d1c44ed-b2f6-4509-9312-1eeb8838e701"
|
||||
|
||||
[[errors]]
|
||||
message = "Database error saving new user"
|
||||
---
|
||||
|
||||
You generally get this error when trying to invite a new user from the dashboard or when trying to insert a user into a table using the table editor in the Supabase dashboard.
|
||||
|
||||
This error is normally associated with a side effect of a database transaction.
|
||||
|
||||
**Common causes of this error:**
|
||||
|
||||
- You have a trigger/trigger function setup on the `auth.users` table
|
||||
- You have added a constraint on the `auth.users` table which isn't being met
|
||||
- You are using Prisma and it has broken all the permissions on the `auth.users` table
|
||||
|
||||
**Debugging this error:**
|
||||
|
||||
- You can use the [Auth logs explorer](https://app.supabase.com/project/_/logs/auth-logs) to find the issue with more information
|
||||
- You can use the [Postgres logs explorer](https://app.supabase.com/project/_/logs/postgres-logs)
|
||||
|
||||
https://user-images.githubusercontent.com/79497/225517698-b6e3ccaf-cd70-4acd-8124-ffbcee310d63.mp4
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title = "Deprecated RLS features"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/16703"
|
||||
date_created = "2023-08-22T13:17:50+00:00"
|
||||
topics = ["database"]
|
||||
keywords = ["rls", "deprecated", "auth", "policy"]
|
||||
---
|
||||
|
||||
## The `auth.role()` function is now deprecated
|
||||
|
||||
The `auth.role()` function has been deprecated in favour of using the `TO` field, natively supported within Postgres:
|
||||
|
||||
```sql
|
||||
-- DEPRECATED
|
||||
create policy "Public profiles are viewable by everyone."
|
||||
on profiles for select using (
|
||||
auth.role() = 'authenticated' or auth.role() = 'anon'
|
||||
);
|
||||
|
||||
-- RECOMMENDED
|
||||
create policy "Public profiles are viewable by everyone."
|
||||
on profiles for select
|
||||
to authenticated, anon
|
||||
using (
|
||||
true
|
||||
);
|
||||
```
|
||||
|
||||
## The `auth.email()` function is now deprecated
|
||||
|
||||
The `auth.email()` function has been deprecated in favour a more generic function to return the full JWT:
|
||||
|
||||
```sql
|
||||
- DEPRECATED
|
||||
create policy "User can view their profile."
|
||||
on profiles for select using (
|
||||
auth.email() = email
|
||||
);
|
||||
|
||||
-- RECOMMENDED
|
||||
create policy "User can view their profile."
|
||||
on profiles for select using (
|
||||
(auth.jwt() ->> 'email') = email
|
||||
);
|
||||
```
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
title = "Disabling Prepared statements"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/28239"
|
||||
date_created = "2024-07-28T15:32:23+00:00"
|
||||
topics = [ "database", "supavisor" ]
|
||||
keywords = [ "prepared", "statements", "transaction", "mode", "disable" ]
|
||||
database_id = "04801b69-e7eb-4f40-8d41-81110397bbc2"
|
||||
---
|
||||
|
||||
### It is important to note that although the direct connections and Supavisor in session mode support prepared statements, Supavisor in transaction mode does not.
|
||||
|
||||
## How to disable prepared statements for Supavisor in transaction mode
|
||||
|
||||
Each ORM or library configures prepared statements differently. Here are settings for some common ones. If you don't see yours, make a comment
|
||||
|
||||
# Prisma:
|
||||
|
||||
add ?pgbouncer=true to end of connection string:
|
||||
|
||||
```
|
||||
postgres://[db-user].[project-ref]:[db-password]@aws-0-[aws-region].pooler.supabase.com:6543/[db-name]?pgbouncer=true
|
||||
```
|
||||
|
||||
# Drizzle:
|
||||
|
||||
Add a prepared false flag to the client:
|
||||
|
||||
```ts
|
||||
export const client = postgres(connectionString, { prepare: false })
|
||||
```
|
||||
|
||||
# Node postgres
|
||||
|
||||
[Just omit the "name" value in a query definition](https://node-postgres.com/features/queries#prepared-statements):
|
||||
|
||||
```ts
|
||||
const query = {
|
||||
name: 'fetch-user', // <--------- DO NOT INCLUDE
|
||||
text: 'SELECT * FROM user WHERE id = $1',
|
||||
values: [1],
|
||||
}
|
||||
```
|
||||
|
||||
# Psycopg
|
||||
|
||||
set the [prepare_threshold](https://www.psycopg.org/psycopg3/docs/api/connections.html#psycopg.Connection.prepare_threshold) to `None`.
|
||||
|
||||
# asyncpg
|
||||
|
||||
Follow the recommendation in the [asyncpg docs](https://magicstack.github.io/asyncpg/current/faq.html#why-am-i-getting-prepared-statement-errors)
|
||||
|
||||
> disable automatic use of prepared statements by passing `statement_cache_size=0` to [asyncpg.connect()](https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.connection.connect) and [asyncpg.create_pool()](https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool) (and, obviously, avoid the use of [Connection.prepare()](https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.connection.Connection.prepare));
|
||||
|
||||
# Rust's Deadpool or tokio-postgres:
|
||||
|
||||
- Check [Github Discussion](https://github.com/bikeshedder/deadpool/issues/340#event-13642472475)
|
||||
+351
@@ -0,0 +1,351 @@
|
||||
---
|
||||
title = "Discovering and Interpreting API Errors in the Logs"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/22849"
|
||||
date_created = "2024-04-18T02:38:44+00:00"
|
||||
topics = [ "database", "platform" ]
|
||||
keywords = [ "logs", "api", "errors", "postgrest", "cloudflare" ]
|
||||
database_id = "188986c9-019d-4f26-baaf-6f58cec8fa7a"
|
||||
---
|
||||
|
||||
> A complimentary [guide](https://github.com/orgs/supabase/discussions/26224) was made for the Postgres logs
|
||||
|
||||
# Navigating the API logs:
|
||||
|
||||
The Database API is powered by a [ PostgREST web-server](https://postgrest.org/en/v12/), recording every request to the API Edge Network logs. To precisely navigate them, use the [Log Explorer](https://supabase.com/dashboard/project/_/logs/explorer). These logs are managed through [Logflare](https://supabase.com/blog/supabase-logs-self-hosted) and can be queried with a subset of BigQuery SQL syntax.
|
||||
|
||||
The log table that contains API requests is `edge_logs`.
|
||||
|
||||
Notably, it contains:
|
||||
| field | description |
|
||||
--------|-------------|
|
||||
| event_message | the log's message |
|
||||
| timestamp | time event was recorded |
|
||||
| request metadata | metadata about the REST request |
|
||||
| response metadata | metadata about the REST response |
|
||||
|
||||
The request and response columns are arrays in the metadata field and must be unnested. This is done with a `cross join`.
|
||||
|
||||
**Unnesting example**
|
||||
|
||||
```sql
|
||||
select
|
||||
-- the event message does not require unnesting
|
||||
event_message,
|
||||
-- unnested status_code column from metadata.response field
|
||||
status_code
|
||||
from
|
||||
edge_logs
|
||||
-- Unpack data stored in the 'metadata' field
|
||||
cross join unnest(metadata) as metadata
|
||||
-- After unpacking the 'metadata' field, extract the 'response' field from it
|
||||
cross join unnest(response) as response;
|
||||
```
|
||||
|
||||
The most useful fields for debugging are:
|
||||
|
||||
> NOTE: not every field is included below. For a full list, check the API Edge field reference in the [Log Explorer](https://supabase.com/dashboard/project/_/logs/explorer)
|
||||
|
||||
## Request object
|
||||
|
||||
### Cloudflare geographic data:
|
||||
|
||||
**Suggested use cases:**
|
||||
|
||||
- Detecting abuse from a specific region
|
||||
- Detecting activity spikes from certain regions
|
||||
|
||||
| Column | Description | Sample value |
|
||||
| -------------------- | --------------------- | ----------------------------------------------------- |
|
||||
| request.cf.city | Requester's city | Munich |
|
||||
| request.cf.country | Requester's country | [DE](https://www.iso.org/iso-3166-country-codes.html) |
|
||||
| request.cf.continent | Requester's continent | EU |
|
||||
| request.cf.region | Requester's region | Bavaria |
|
||||
| request.cf.latitudex | Requester's latitude | 48.10840 |
|
||||
| request.cf.longitude | Requester's longitude | 11.61020 |
|
||||
| request.cf.timezone | Requester's timezone | Europe/Berlin |
|
||||
|
||||
**Unnesting example:**
|
||||
|
||||
```sql
|
||||
select
|
||||
city
|
||||
from
|
||||
edge_logs
|
||||
-- Unpack 'metadata' field
|
||||
cross join unnest(metadata) AS metadata
|
||||
-- unpack 'request' from 'metadata'
|
||||
cross join unnest(request) AS request;
|
||||
-- unpack 'cf' from 'request'
|
||||
cross join unnest(cf) AS cf;
|
||||
```
|
||||
|
||||
### IP and browser/environment data:
|
||||
|
||||
**Suggested use cases:**
|
||||
|
||||
- Detecting request behavior from IP
|
||||
- Detecting abuse by IP
|
||||
- Detecting errors by user_agent
|
||||
|
||||
| Column | Description | Sample value |
|
||||
| -------------------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
||||
| request.headers.cf_connecting_ip | Requester's IP | 80.81.18.138 |
|
||||
| request.headers.user_agent | Requester's browser or app environment | Mozilla/5.0 (Linux; Android 11; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36 |
|
||||
|
||||
**Unnesting example:**
|
||||
|
||||
```sql
|
||||
select
|
||||
cf_connecting_ip
|
||||
from
|
||||
edge_logs
|
||||
-- Unpack 'metadata' field
|
||||
cross join unnest(metadata) AS metadata
|
||||
-- unpack 'request' from 'metadata'
|
||||
cross join unnest(request) AS request;
|
||||
-- unpack 'headers' from 'request'
|
||||
cross join unnest(headers) AS headers;
|
||||
```
|
||||
|
||||
### Query type and formatting data:
|
||||
|
||||
**Suggested use cases:**
|
||||
|
||||
- identify problematic queries
|
||||
- identify unusual behavior by authenticated users
|
||||
|
||||
| Column | Description | Sample value |
|
||||
| --------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
||||
| request.method | Request Method (PATCH, GET, PUT...) | GET |
|
||||
| request.url | Request URL, which contains the PostgREST formatted query | https://yuhplfrsdxxxtldakizi.supabase.co/rest/v1/users?select=username&id=eq.63b6190e-214f-4b8a-b72d-3af6e1921411&limit=1 |
|
||||
| request.sb.auth_users | authenticated user's ID | 63b6190e-214f-4b8a-b72d-3af6e1921411 |
|
||||
|
||||
**Unnesting example:**
|
||||
|
||||
```sql
|
||||
select
|
||||
method,
|
||||
url,
|
||||
auth_users
|
||||
from
|
||||
edge_logs
|
||||
-- Unpack 'metadata' field
|
||||
cross join unnest(metadata) AS metadata
|
||||
-- unpack 'request' from 'metadata'
|
||||
cross join unnest(request) AS request;
|
||||
-- unpack 'sb' from 'request'
|
||||
cross join unnest(sb) AS sb;
|
||||
```
|
||||
|
||||
## Response object
|
||||
|
||||
### Status code:
|
||||
|
||||
**Suggested use cases:**
|
||||
|
||||
- detect success/errors
|
||||
|
||||
| Column | Description | Sample value |
|
||||
| -------------------- | --------------------------------------- | ------------ |
|
||||
| response.status_code | Response status code (200, 404, 500...) | 404 |
|
||||
|
||||
**Unnesting example:**
|
||||
|
||||
```sql
|
||||
select
|
||||
status_code
|
||||
from
|
||||
edge_logs
|
||||
-- Unpack 'metadata' field
|
||||
cross join unnest(metadata) as metadata
|
||||
-- unpack 'response' from 'metadata'
|
||||
cross join unnest(response) as response;
|
||||
```
|
||||
|
||||
# Finding errors
|
||||
|
||||
### API level errors
|
||||
|
||||
The `metadata.request.url` contains PostgREST formatted queries.
|
||||
|
||||
For example, the following call to the JS client:
|
||||
|
||||
```js
|
||||
let { data: countries, error } = await supabase.from('countries').select('name')
|
||||
```
|
||||
|
||||
translates to calling the following endpoint:
|
||||
|
||||
```bash
|
||||
https://<project ref>.supabase.co/rest/v1/countries?select=name
|
||||
```
|
||||
|
||||
You can use regex ([Advanced Regex Guide](https://github.com/orgs/supabase/discussions/22640)) to find the objects related to your query. Try isolating by:
|
||||
|
||||
- function names
|
||||
- column names
|
||||
- table names
|
||||
- query methods (select, insert, ...)
|
||||
|
||||
Example:
|
||||
|
||||
```sql
|
||||
select
|
||||
cast(timestamp as datetime) as timestamp,
|
||||
status_code,
|
||||
url,
|
||||
event_message
|
||||
from edge_logs
|
||||
cross join unnest(metadata) as metadata
|
||||
cross join unnest(response) AS request;
|
||||
cross join unnest(response) AS response;
|
||||
where
|
||||
-- find all errors
|
||||
status_code >= 400
|
||||
and
|
||||
-- find queries featuring the a specific <table_name> and <column_name>
|
||||
(
|
||||
regexp_contains(url, '<table_name>')
|
||||
and
|
||||
regexp_contains(event_message, '<column_name1>|<column_name2>')
|
||||
)
|
||||
```
|
||||
|
||||
PostgREST has an [error reference table](https://postgrest.org/en/v12/references/errors.html) that you can use to interpret status codes.
|
||||
|
||||
### Database-level errors
|
||||
|
||||
However, some errors that are reported through the Database API occur at the PostgreSQL level. If it is not clear which error occurred you should reference the timestamp of the error and try to see if you can find it in the Postgres logs.
|
||||
|
||||
```sql
|
||||
select
|
||||
cast(postgres_logs.timestamp as datetime) as timestamp,
|
||||
error_severity,
|
||||
user_name,
|
||||
query,
|
||||
detail,
|
||||
sql_state_code,
|
||||
event_message
|
||||
from postgres_logs
|
||||
cross join unnest(metadata) as metadata
|
||||
cross join unnest(metadata.parsed) as parsed
|
||||
where
|
||||
-- filter only for error events
|
||||
regexp_contains(parsed.error_severity, 'ERROR|FATAL|PANIC')
|
||||
and
|
||||
-- All DB API requests are registered as the authenticator role
|
||||
parsed.user_name = 'authenticator'
|
||||
and
|
||||
-- find failed queries featuring the function <function_name>
|
||||
regexp_contains(parsed.query, '<function_name>')
|
||||
and
|
||||
-- limit the time of the search to be around the time of the failed API request
|
||||
postgres_logs.timestamp between '2024-04-15 10:50:00' AND '2024-04-15 10:50:27'
|
||||
order by
|
||||
timestamp desc
|
||||
limit 100;
|
||||
```
|
||||
|
||||
Like PostgREST, PostgreSQL has a [reference table](https://www.postgresql.org/docs/current/errcodes-appendix.html) for interpreting error codes.
|
||||
|
||||
## PostgREST server and Cloudflare errors
|
||||
|
||||
In some cases, errors may emerge because of Cloudflare or PostgREST server errors. For 500 and above errors, you may want to check your [PostgREST](https://supabase.com/dashboard/project/_/logs/postgrest-logs) logs and the [Cloudflare docs.](https://developers.cloudflare.com/support/troubleshooting/cloudflare-errors/troubleshooting-cloudflare-5xx-errors/#error-502-bad-gateway-or-error-504-gateway-timeout))
|
||||
|
||||
# Practical examples:
|
||||
|
||||
**Find All Errors:**
|
||||
|
||||
```sql
|
||||
select
|
||||
cast(timestamp as datetime) as timestamp,
|
||||
status_code,
|
||||
event_message,
|
||||
path
|
||||
from
|
||||
edge_logs
|
||||
cross join unnest(metadata) as metadata
|
||||
cross join unnest(response) as response
|
||||
cross join unnest(request) as request
|
||||
where
|
||||
-- find all errors
|
||||
status_code >= 400
|
||||
and regexp_contains(path, '^/rest/v1/');
|
||||
-- only look at DB API
|
||||
```
|
||||
|
||||
**Group errors by path and code:**
|
||||
|
||||
```sql
|
||||
select
|
||||
status_code,
|
||||
path,
|
||||
count(path) as reoccurrence_per_path
|
||||
from
|
||||
edge_logs
|
||||
cross join unnest(metadata) as metadata
|
||||
cross join unnest(response) as response
|
||||
cross join unnest(request) as request
|
||||
where
|
||||
-- find all errors
|
||||
status_code >= 400
|
||||
and regexp_contains(path, '^/rest/v1/') -- only look at DB API
|
||||
group by path, status_code
|
||||
order by reoccurrence_per_path;
|
||||
```
|
||||
|
||||
**Find requests by region:**
|
||||
|
||||
```sql
|
||||
select
|
||||
path,
|
||||
region,
|
||||
count(region) as region_count
|
||||
from
|
||||
edge_logs
|
||||
cross join unnest(metadata) as metadata
|
||||
cross join unnest(request) as request
|
||||
cross join unnest(cf) as cf
|
||||
where
|
||||
-- only look at DB API
|
||||
regexp_contains(path, '^/rest/v1/')
|
||||
group by region, path
|
||||
order by requester_region_count;
|
||||
```
|
||||
|
||||
**Find total requests by IP:**
|
||||
|
||||
```sql
|
||||
select
|
||||
cf_connecting_ip as ip,
|
||||
count(cf_connecting_ip) as ip_count
|
||||
from
|
||||
edge_logs
|
||||
cross join unnest(metadata) as metadata
|
||||
cross join unnest(request) as request
|
||||
cross join unnest(headers) as headers
|
||||
cross join unnest(cf) as cf
|
||||
cross join unnest(response) as response
|
||||
where regexp_contains(path, '^/auth/v1/')
|
||||
group by ip
|
||||
order by ip_count;
|
||||
```
|
||||
|
||||
**Search frequented query paths by authenticated user:**
|
||||
|
||||
```sql
|
||||
select
|
||||
-- only available for front-end clients
|
||||
auth_users,
|
||||
path,
|
||||
count(auth_users) as ip_count
|
||||
from
|
||||
edge_logs
|
||||
cross join unnest(metadata) as metadata
|
||||
cross join unnest(request) as request
|
||||
cross join unnest(sb) as sb
|
||||
where
|
||||
-- only look at DB API
|
||||
regexp_contains(path, '^/rest/v1/')
|
||||
group by auth_users, path;
|
||||
```
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title = 'Do I need to expose "security definer" Functions in Row Level Security Policies?'
|
||||
github_url = "https://github.com/orgs/supabase/discussions/16784"
|
||||
date_created = "2023-08-24T13:45:01+00:00"
|
||||
topics = ["database"]
|
||||
keywords = ["security", "function", "schema", "policy", "definer"]
|
||||
---
|
||||
|
||||
PostgREST supports 2 config parameters:
|
||||
|
||||
- Exposed Schemas
|
||||
- Extra Search Path
|
||||
|
||||

|
||||
|
||||
You do not need to add your "security definer" Functions to either of these if you are using them in your Policies.
|
||||
|
||||
PostgREST doesn’t need to know about this function on extra search path or exposed schemas, as long as you explicitly use the schema inside RLS (eg: `security.rls_func`).
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title = "Edge Function 'wall clock time limit reached'"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21293"
|
||||
date_created = "2024-02-15T11:42:58+00:00"
|
||||
topics = [ "functions" ]
|
||||
keywords = [ "wall clock", "limit", "time", "shutdown" ]
|
||||
database_id = "5a3a0125-84c7-463b-a886-ca53edfba5f4"
|
||||
|
||||
[[errors]]
|
||||
http_status_code = 546
|
||||
message = "Edge Function 'wall clock time limit reached'"
|
||||
---
|
||||
|
||||
**What Does "Wall Clock Time Limit Reached" Mean?**
|
||||
|
||||
The message "wall clock time limit reached" typically indicates that a process has reached the maximum time allowed for execution. This time is measured by a clock, similar to a system clock or a clock on the wall. It encompasses the entire duration a process takes to complete, including any periods of inactivity or waiting.
|
||||
|
||||
When this message appears in the context of your edge function, it means that the function has emitted a Shutdown event either after reaching the specified wall clock duration or when it hits a resource limit such as CPU time used or memory utilized.
|
||||
|
||||
**Current Limits Explained**
|
||||
|
||||
- Wall Clock Time Limit: Currently set at 400 seconds for the total duration your edge function can run.
|
||||
- CPU Execution Time: Limited to 200 milliseconds of active computing.
|
||||
|
||||
This means that if your edge function completes its task within these time constraints, there's no need to be concerned about the "wall clock time limit reached" error message.
|
||||
|
||||
Because the "wall clock time limit reached" warning can be expected in some cases. This message is hard-coded to be printed out when the worker has been terminated, even if it hasn't reached the time limit. However, if your function terminates with this warning and returns a 546 error response, then this indicates that your function is exceeding the allowed execution time, signaling a long-running task.
|
||||
|
||||
**Steps to Troubleshoot**
|
||||
If you're facing the "wall clock time limit reached" error with a 546 error code, here are actions to take:
|
||||
|
||||
- Review Your Function's Logic: Examine the operations within your edge function for any inefficiencies or prolonged processes. Consider optimizing code, minimizing unnecessary calculations, and implementing asynchronous operations where possible.
|
||||
|
||||
- Divide Complex Tasks: For functions handling complex or extensive tasks, try breaking them down into smaller, discrete functions. This approach can help manage workloads more effectively and stay within time limits.
|
||||
|
||||
- Monitor Execution Time: Use our logging or monitoring tools available to keep an eye on your function's performance. This can pinpoint where optimizations are necessary. To access logs visit: [Supabase Project Functions](https://app.supabase.com/project/_/functions) Select your function and click on Logs.
|
||||
|
||||
- Check Our Guides: For more tips, refer to our debugging guide here: [Debugging Edge Functions](https://supabase.com/docs/guides/functions/debugging#logs--debugging)
|
||||
|
||||
**Future Considerations**
|
||||
There are plans to make the wall clock time limit configurable per project in the future. However, currently, the only way to adjust this limit is by self-hosting [Edge Functions](https://github.com/supabase/edge-runtime/).
|
||||
|
||||
Stay updated on changes by regularly checking our changelog [here](https://github.com/orgs/supabase/discussions/categories/changelog).
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title = "Error: \"Connection refused\" when trying to connect to Supabase database"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/14929"
|
||||
date_created = "2023-06-09T10:38:06+00:00"
|
||||
topics = [ "database", "cli" ]
|
||||
keywords = [ "connection", "fail2ban", "econnrefused" ]
|
||||
database_id = "9d8b179c-ff4d-4072-b9e6-2d16e63b2aaa"
|
||||
|
||||
[api]
|
||||
cli = [ "supabase-network-bans-get", "supabase-network-bans-remove" ]
|
||||
|
||||
[[errors]]
|
||||
message = "connect ECONNREFUSED 1.2.3.4:5432"
|
||||
|
||||
[[errors]]
|
||||
message = "psql: error: connection to server at \"db.xxxxxxxxxxxxxxxxxxxx.supabase.co\" (1.2.3.4), port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?"
|
||||
---
|
||||
|
||||
If you're not able to connect to the Supabase database and see the error `connect ECONNREFUSED 1.2.3.4:5432` or `psql: error: connection to server at "db.xxxxxxxxxxxxxxxxxxxx.supabase.co" (1.2.3.4), port 5432 failed: Connection refused
|
||||
Is the server running on that host and accepting TCP/IP connections?`, this could be because there are banned IPs on your project caused by Fail2ban as it kicks in when attempting 2 wrong passwords in a row.
|
||||
|
||||
These bans will clear after 30mins but you can unban the IPs using the Supabase CLI https://supabase.com/docs/guides/cli following the commands below.
|
||||
|
||||
How to list the banned IPs:
|
||||
|
||||
```
|
||||
% supabase network-bans get --project-ref <project_reference_id> --experimental
|
||||
```
|
||||
|
||||
How to unban the IPs:
|
||||
|
||||
```
|
||||
% supabase network-bans remove --db-unban-ip <ip_address> --project-ref <project_reference_id> --experimental
|
||||
```
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
---
|
||||
title = "Error: index row size exceeds btree version 4 maximum for index"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/14898"
|
||||
date_created = "2023-06-08T11:35:27+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "btree", "index", "attribute", "size", "hashing" ]
|
||||
database_id = "da3aa582-b115-44e2-97e3-9ab76206f0db"
|
||||
|
||||
[[errors]]
|
||||
message = "index row size exceeds btree version 4 maximum 2704 for index \"idx_name\""
|
||||
---
|
||||
|
||||
## Error
|
||||
|
||||
```
|
||||
index row size exceeds btree version 4 maximum 2704 for index "idx_name"
|
||||
```
|
||||
|
||||
## Summary
|
||||
|
||||
PG has a limit on a BTree tuple(=row) size. It needs to fit at least 3 btree tuples on a 8Kb page. That could not be changed.
|
||||
|
||||
BTree row can be a single attribute or multiple attributes. These cases are better addressed separately.
|
||||
|
||||
## BTree is built with multiple attributes
|
||||
|
||||
BTree with multiple attributes will perform better than several only in case the likely SELECT queries use several attributes that include the first attributes that are in the index. I.e. select by 1-st, 2-nd, 3-d but not by 2-nd, 3-d and 5-th index attributes.
|
||||
|
||||
The other case when multiple attributes BTree is good is when we have INSERT/UPDATE workload that is comparable to SELECT load (generally SELECTS a way more often). Then we can save speed-up updating a single index instead of several at INSERT/UPDATE at cost of SELECT performance decrease.
|
||||
|
||||
But most likely we have multiple attributes BTree index due to some automation tool, not by intention. Even without the mentioned error it's best to build separate single-attribute indexes for each attribute from it. Then drop multiple attributes BTree index. This is a must and the only solution when we have this error though.
|
||||
|
||||
## BTree is built on a single attribute that is very long
|
||||
|
||||
This can be if the index is built on text, JSON column etc. It's not prohibited to build BTree on these datatypes, but it's also ineffective. Why?
|
||||
|
||||
One of the measures of index efficiency is the ratio of index entries to the width of all possible values space for this datatype. If we have say 100000 distinct values of int32 in the index then the ratio is 1/40000. If we have text with length of 2704 bytes (maximum for BTree index) we can hardly imagine the number of distinct values that gives us even a comparable ratio. That said indexing of that long values stores much redundancy in the index.
|
||||
|
||||
The solution is simple: use some king of hashing to transfer the values to much narrower space. I.e. md5. The solution is simple, you build a functional index (=index by expression):
|
||||
|
||||
```sql
|
||||
CREATE INDEX ON table_name(MD5(column_name));
|
||||
```
|
||||
|
||||
instead of:
|
||||
|
||||
```sql
|
||||
CREATE INDEX ON table_name(column_name);
|
||||
```
|
||||
|
||||
Then you must modify you SELECTs to be using the same function (otherwise the functional index will not be used in SELECT queries). I.e.
|
||||
|
||||
```sql
|
||||
select * from table_name where MD5(column_name) = MD5('search_value');
|
||||
```
|
||||
|
||||
instead of
|
||||
|
||||
```sql
|
||||
select * from table_name where column_name = 'search_value';
|
||||
```
|
||||
|
||||
[More on building index by expression](https://www.postgresql.org/docs/current/sql-createindex.html)
|
||||
|
||||
For some datatypes other than text that allows queries by partial inclusion (i.e. that the pair key-value is includes in a JSON or for implementing tsvector phrase search) you'd just use GIST/GIN indexes that inherently have values space much narrower that the whole to be indexed.
|
||||
|
||||
[More on GIN/GiST indexes](https://www.postgresql.org/docs/15/textsearch-indexes.html)
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title = "Error: \"Invalid TOTP code entered\""
|
||||
github_url = "https://github.com/orgs/supabase/discussions/19676"
|
||||
date_created = "2023-12-13T15:01:15+00:00"
|
||||
topics = [ "auth" ]
|
||||
keywords = [ "totp" ]
|
||||
database_id = "58d5a2de-2f7e-45fc-8dfa-7fb36da41ca8"
|
||||
|
||||
[api]
|
||||
sdk = [ "auth-verifyotp" ]
|
||||
|
||||
[[errors]]
|
||||
message = "Invalid TOTP code entered"
|
||||
---
|
||||
|
||||
This error would generally happen if there is an incorrect device clock setting and there is no time sync. Please check and make sure your device clock shows the correct local time, date, and time zone to work properly.
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
---
|
||||
title = "error: no pg_hba.conf entry for host \"xx.xxx.xxx.xxx\", user \"postgres\", database \"postgres\", SSL off"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21145"
|
||||
date_created = "2024-02-09T11:48:08+00:00"
|
||||
topics = [ "database", "platform" ]
|
||||
keywords = [ "ssl", "authentication", "connection" ]
|
||||
database_id = "0739256c-1b25-46ec-963b-2f8e4dccedc7"
|
||||
|
||||
[[errors]]
|
||||
message = "no pg_hba.conf entry for host \"xx.xxx.xxx.xxx\", user \"postgres\", database \"postgres\", SSL off"
|
||||
---
|
||||
|
||||
This error indicates a failed authentication attempt to the database and the connection couldn't be established.
|
||||
|
||||
In Supabase, this is generally seen when [SSL enforcement](https://supabase.com/docs/guides/platform/ssl-enforcement) is enabled on your Supabase Project. The authentication failed because the incoming connection didn't use SSL encryption when connecting to the database.
|
||||
|
||||
You can ignore this message if the attempt is from an unknown user. If you want this connection attempt to be successful, you will either need to connect with SSL or disable SSL enforcement on your Supabase project.
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title = "Error: prepared statement \"XXX\" already exists"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/17751"
|
||||
date_created = "2023-09-27T09:53:08+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "pgbouncer", "prepared", "connection" ]
|
||||
database_id = "8688dad6-3dce-4912-9b90-4f128daf79d7"
|
||||
|
||||
[[errors]]
|
||||
message = "prepared statement \"XXX\" already exists"
|
||||
---
|
||||
|
||||
This error occurs when you are trying to connect to the database using PgBouncer. PgBouncer does not support prepared statements. If you have prepared statements in use, you will need to use direct connections - port 5432.
|
||||
|
||||
There is a special parameter in the query string for Prisma to work with PgBouncer
|
||||
https://www.prisma.io/docs/guides/performance-and-optimization/connection-management/configure-pg-bouncer
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title = "Failed to Fetch in dashboard and other areas -- browser extension"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/17296"
|
||||
date_created = "2023-09-09T13:22:26+00:00"
|
||||
topics = [ "studio" ]
|
||||
keywords = [ "cors" ]
|
||||
database_id = "23c4e1b5-c7e7-497f-acf8-006133e243a4"
|
||||
|
||||
[[errors]]
|
||||
message = "Failed to Fetch"
|
||||
---
|
||||
|
||||
Although Failed to Fetch can occur for a variety of reasons a common one in the dashboard or when using update code is related to a browser extension.
|
||||
|
||||

|
||||
|
||||
https://chrome.google.com/webstore/detail/allow-cors-access-control/lhobafahddgcelffkeicbaginigeejlf
|
||||
|
||||
This extension sets PATCH to be blocked by default for some reason...
|
||||
|
||||
<img
|
||||
width="704"
|
||||
alt="168501713-5f020510-4555-4cc3-84de-582efc1c62de"
|
||||
src="https://github.com/supabase/supabase/assets/54564956/c61b9292-2954-4c68-8129-995941f36210"
|
||||
/>
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title = "Failed to restore from backup: All subscriptions and replication slots must be dropped before a backup can be restored."
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21830"
|
||||
date_created = "2024-03-07T02:47:01+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "backup", "restore", "replication", "subscription" ]
|
||||
database_id = "aa5fda82-5838-4975-b0ac-ba4d7fb9e638"
|
||||
|
||||
[[errors]]
|
||||
message = "All subscriptions and replication slots must be dropped before a backup can be restored."
|
||||
---
|
||||
|
||||
As the error suggests, you must first drop any current subscriptions or replication slots to restore backups.
|
||||
|
||||
You can check those with:
|
||||
|
||||
```
|
||||
SELECT * FROM pg_replication_slots;
|
||||
|
||||
SELECT * FROM pg_subscription;
|
||||
```
|
||||
|
||||
You can drop them with:
|
||||
|
||||
```
|
||||
DROP SUBSCRIPTION <subscription>;
|
||||
|
||||
SELECT pg_drop_replication_slot(slot_name);
|
||||
```
|
||||
|
||||
NOTE: These are destructive actions. This is fine since you will overwrite your database with a backup.
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title = "Fetch requests to API endpoints aren't showing the session"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/15859"
|
||||
date_created = "2023-07-18T12:22:14+00:00"
|
||||
topics = [ "auth" ]
|
||||
keywords = [ "session", "cookie" ]
|
||||
database_id = "6f19b113-09cb-45ce-8141-0d6dc10ea464"
|
||||
---
|
||||
|
||||
You must pass along the cookie header with the fetch request in order for your API endpoint to get access to the cookie from this request.
|
||||
|
||||
```ts
|
||||
const res = await fetch('http://localhost:3000/contact', {
|
||||
headers: {
|
||||
cookie: headers().get('cookie') as string,
|
||||
},
|
||||
})
|
||||
```
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
---
|
||||
title = "Fixing 520 Errors in the Database REST API"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/23422"
|
||||
date_created = "2024-04-29T16:56:27+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "520", "cloudflare", "url", "headers", "rpcs" ]
|
||||
database_id = "6ec0c9a3-b52b-49b9-ba6e-c91984f7f9bf"
|
||||
|
||||
[[errors]]
|
||||
http_status_code = 520
|
||||
message = "Web server returns an unknown error due to request exceeding 16KB in headers/URL."
|
||||
---
|
||||
|
||||
In the context of the database API, [Cloudflare 520 errors](https://developers.cloudflare.com/support/troubleshooting/cloudflare-errors/troubleshooting-cloudflare-5xx-errors/#error-520-web-server-returns-an-unknown-error) most often occur when 16+KB worth of data is present in the headers/URL of your requests.
|
||||
|
||||
The API will include filters within the URL, so a request like so:
|
||||
|
||||
```javascript
|
||||
let { data: countries, error } = await supabase.from('countries').select('name')
|
||||
```
|
||||
|
||||
translates to a URL like:
|
||||
|
||||
```bash
|
||||
https://<project ref>.supabase.co/rest/v1/countries?select=name
|
||||
```
|
||||
|
||||
However, appending too much data to the URL can exceed the 16KB limitation, triggering a 520 failure. This typically occurs with lengthy `in` clauses, as demonstrated here:
|
||||
|
||||
```javascript
|
||||
const { data, error } = await supabase
|
||||
.from('countries')
|
||||
.select()
|
||||
.not('id', 'in', '(5,6,7,8,9,...10,000)')
|
||||
```
|
||||
|
||||
To circumvent this issue, you must use [RPCs](https://supabase.com/docs/reference/javascript/explain?queryGroups=example&example=call-a-postgres-function-with-arguments). They are database functions that you can call from the API. Instead of including a query's structure within the URL or header, they move it into the request's payload.
|
||||
|
||||
Here is a basic example of a [database function](https://supabase.com/docs/guides/database/functions)
|
||||
|
||||
```sql
|
||||
create or replace function example(id uuid[])
|
||||
returns uuid[]
|
||||
language plpgsql
|
||||
as $$
|
||||
begin
|
||||
raise log 'the function example was called with an array size of: %', (select array_length(id, 1));
|
||||
return id;
|
||||
end;
|
||||
$$;
|
||||
```
|
||||
|
||||
The [RPC](https://supabase.com/docs/reference/javascript/explain?queryGroups=example&example=call-a-postgres-function-with-arguments) can then call the function with an array that contains more than 16KB of data
|
||||
|
||||
```javascript
|
||||
const { data, error } = await supabase.rpc('example', { id: ['e2f34fb9-bbf9-4649-9b2f-09ec56e67a42', ...900 more UUIDs] })
|
||||
```
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title = "Forbidden resource error from the CLI"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21602"
|
||||
date_created = "2024-02-27T09:37:38+00:00"
|
||||
topics = [ "cli", "platform" ]
|
||||
keywords = [ "cli", "authorization", "token", "permissions" ]
|
||||
database_id = "b095c3ed-23e7-4a17-9e33-d811af25ba67"
|
||||
|
||||
[api]
|
||||
cli = [ "supabase-link", "supabase-login" ]
|
||||
|
||||
[[errors]]
|
||||
http_status_code = 403
|
||||
message = "Forbidden resource error"
|
||||
---
|
||||
|
||||
This error typically occurs as a protective measure to prevent unauthorized access to critical operations.
|
||||
|
||||
To address this issue, we recommend following these troubleshooting steps:
|
||||
|
||||
- Verify Project ID: Ensure the $PROJECT*REF variable in your commands contains the correct Project ID. You can find your Reference ID under [Project -> Settings -> General](https://supabase.com/dashboard/project/*/settings/general) in your Supabase Dashboard. A Reference ID looks something like “xvljpkujuwroxcuvossw”.
|
||||
- Authorization Check: Confirm that you’ve been properly authorized. You can also generate a new Access Token in your dashboard and use it for login. Generate a new token [here](https://supabase.com/dashboard/account/tokens) and use it to [log in](https://supabase.com/docs/reference/cli/supabase-login).
|
||||
- Re-link Project: Try [re-linking](https://supabase.com/docs/reference/cli/supabase-link) your project with the newly generated token.
|
||||
- Owner/Admin Permissions: Make sure you have [Owner/Admin](https://supabase.com/docs/guides/platform/access-control) permissions for the project.
|
||||
- CLI Version: Ensure you are using the latest version of the Supabase CLI. If not, please update to the most recent version available at [Supabase CLI GitHub](https://github.com/supabase/cli).
|
||||
|
||||
If the issue persists, add a --debug --create-ticket flags to your command and contact [support](https://supabase.com/support) with the ticket id and debug logs, which can help in diagnosing the problem further.
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
title = "Google Auth fails for some users"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/14883"
|
||||
date_created = "2023-06-07T20:38:48+00:00"
|
||||
topics = [ "auth" ]
|
||||
keywords = [ "OAuth", "Google", "credential", "email" ]
|
||||
database_id = "1ea7b605-dc1d-43d8-a365-5bc2801dd90e"
|
||||
|
||||
[api]
|
||||
sdk = [ "supabase.auth.signInWithOAuth" ]
|
||||
|
||||
[[errors]]
|
||||
http_status_code = 500
|
||||
code = "server_error"
|
||||
message = "Error getting user email from external provider"
|
||||
|
||||
[[errors]]
|
||||
http_status_code = 401
|
||||
code = "UNAUTHENTICATED"
|
||||
message = "Missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential."
|
||||
---
|
||||
|
||||
## Google Auth fails for some users
|
||||
|
||||
If you start facing either of these errors:
|
||||
|
||||
```
|
||||
error=server_error&error_description=Error+getting+user+email+from+external+provider
|
||||
|
||||
Missing required authentication credential.
|
||||
|
||||
Expected OAuth 2 access token, login cookie or other valid authentication credential.
|
||||
|
||||
See https://developers.google.com/identity/sign-in/web/devconsole-project.\",\n \"status\": \"UNAUTHENTICATED\"
|
||||
|
||||
}
|
||||
"level":"error","method":"GET","msg":"500: Error getting user email from external provider","path":"/callback","referer":"https://accounts.google.com/","remote_addr":"x.x.X.x","time":"2023-06-06T21:46:11Z","timestamp":"2023-06-06T21:46:11Z"}
|
||||
```
|
||||
|
||||
It is happening because some Google Suite requires the explicit request of email Auth Scopes:
|
||||
`https://www.googleapis.com/auth/userinfo.email`
|
||||
|
||||
```js
|
||||
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||
provider: 'google'
|
||||
options: {
|
||||
scopes: 'https://www.googleapis.com/auth/userinfo.email'
|
||||
}
|
||||
})
|
||||
```
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
title = "Grafana not displaying data"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/30579"
|
||||
date_created = "2024-11-21T03:45:05+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "grafana", "docker", "metrics", "configuration" ]
|
||||
database_id = "76a4099e-450f-4b5b-a539-224760348c18"
|
||||
---
|
||||
|
||||
This guide is for identifying configuration mistakes in [self-hosted Supabase Grafana installations](https://supabase.com/docs/guides/monitoring-troubleshooting/metrics#deploying-supabase-grafana)
|
||||
|
||||
## Step 1: Ping your Grafana endpoint
|
||||
|
||||
Use 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:<SERVICE_ROLE_KEY>'
|
||||
```
|
||||
|
||||
## Step 2: Set your Grafana Dashboard to auto-refresh in the top right corner
|
||||
|
||||

|
||||
|
||||
## Step 3: Make sure your docker container has the default configurations
|
||||
|
||||
Run the following command in the terminal:
|
||||
|
||||
```sh
|
||||
docker ps -f name=supabase-grafana
|
||||
```
|
||||
|
||||
The output should look something like this:
|
||||
|
||||

|
||||
|
||||
Here it is in an easier to read format
|
||||
|
||||
- CONTAINER ID: < container id >
|
||||
- IMAGE: supabase-grafana-supabase-grafana
|
||||
- COMMAND: /entrypoint.sh
|
||||
- CREATED: < time >
|
||||
- STATUS: Up < unit of time > ago
|
||||
- PORTS: 3000/tcp, 0.0.0.0:8000 → 8080/tcp
|
||||
- NAMES: supabase-grafana-supabase-grafana-1
|
||||
|
||||
## Step 4: Enter the container
|
||||
|
||||
Try running the following terminal command:
|
||||
|
||||
```sh
|
||||
docker exec -it <container id> bash
|
||||
```
|
||||
|
||||
## Step 5: Check the environment variables for errors
|
||||
|
||||
Run the following in the docker container:
|
||||
|
||||
```sh
|
||||
printenv | egrep 'GRAFANA_PASSWORD|SUPABASE_PROJECT_REF|SUPABASE_SERVICE_ROLE_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.
|
||||
|
||||
## Step 6: Go to the root folder and check permissions on the `entrypoint.sh` file
|
||||
|
||||
Run the following terminal commands:
|
||||
|
||||
```sh
|
||||
cd /
|
||||
ls -l | grep entrypoint.sh
|
||||
```
|
||||
|
||||
`entrypoint.sh` should have the following permissions:
|
||||
|
||||
```sh
|
||||
-rwxr-xr-x
|
||||
```
|
||||
|
||||
If off, update the values
|
||||
|
||||
```sh
|
||||
chmod +x entrypoint.sh
|
||||
```
|
||||
@@ -0,0 +1,99 @@
|
||||
---
|
||||
title = "High latency with supabase client"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/22100"
|
||||
date_created = "2024-03-17T14:15:25+00:00"
|
||||
topics = [ "database", "platform" ]
|
||||
keywords = [ "latency", "client", "performance" ]
|
||||
database_id = "a715c0d3-8636-41b7-a6da-6d49f1b1777c"
|
||||
---
|
||||
|
||||
## Describe the bug
|
||||
|
||||
Querying a table using the Supabase client is much slower than querying against the Postgres database directly.
|
||||
|
||||
## To reproduce
|
||||
|
||||
1. Execute the below DDL statements.
|
||||
|
||||
```
|
||||
-- Create table
|
||||
CREATE TABLE your_table_name (
|
||||
id UUID PRIMARY KEY,
|
||||
column1 TEXT,
|
||||
column2 INT,
|
||||
column3 BOOLEAN
|
||||
);
|
||||
|
||||
-- Insert statements
|
||||
INSERT INTO your_table_name (id, column1, column2, column3) VALUES
|
||||
(uuid_generate_v4(), 'value1', 10, TRUE),
|
||||
(uuid_generate_v4(), 'value2', 20, FALSE),
|
||||
(uuid_generate_v4(), 'value3', 15, TRUE),
|
||||
(uuid_generate_v4(), 'value4', 8, FALSE),
|
||||
(uuid_generate_v4(), 'value5', 25, TRUE),
|
||||
(uuid_generate_v4(), 'value6', 12, FALSE),
|
||||
(uuid_generate_v4(), 'value7', 18, TRUE),
|
||||
(uuid_generate_v4(), 'value8', 30, FALSE),
|
||||
(uuid_generate_v4(), 'value9', 22, TRUE),
|
||||
(uuid_generate_v4(), 'value10', 5, FALSE),
|
||||
(uuid_generate_v4(), 'value11', 17, TRUE),
|
||||
(uuid_generate_v4(), 'value12', 9, FALSE),
|
||||
(uuid_generate_v4(), 'value13', 14, TRUE),
|
||||
(uuid_generate_v4(), 'value14', 28, FALSE),
|
||||
(uuid_generate_v4(), 'value15', 11, TRUE),
|
||||
(uuid_generate_v4(), 'value16', 7, FALSE),
|
||||
(uuid_generate_v4(), 'value17', 19, TRUE),
|
||||
(uuid_generate_v4(), 'value18', 26, FALSE),
|
||||
(uuid_generate_v4(), 'value19', 16, TRUE),
|
||||
(uuid_generate_v4(), 'value20', 21, FALSE);
|
||||
```
|
||||
|
||||
2. Run the following script (you may need to `pip install psycopg[binary]` in addition to supabase client.
|
||||
|
||||
```
|
||||
import time
|
||||
from supabase import Client, create_client
|
||||
|
||||
import psycopg
|
||||
|
||||
|
||||
def psycop_call(): #user_ids: list[str]):
|
||||
user="YOUR_SUPABASE_USER"
|
||||
password="YOUR_SUPABASE_PASSWORD"
|
||||
host="SUPABASE_HOST"
|
||||
port=5432
|
||||
database="postgres"
|
||||
|
||||
with psycopg.connect(f"host={host} port={port} dbname={database} user={user} password={password}") as conn:
|
||||
# Open a cursor to perform database operations
|
||||
results = []
|
||||
with conn.cursor() as cur:
|
||||
start = time.time()
|
||||
# Execute a command: this creates a new table
|
||||
cur.execute("SELECT * FROM public.your_table_name")
|
||||
cur.fetchall()
|
||||
for record in cur:
|
||||
results.append(record)
|
||||
stop = time.time()
|
||||
return (stop - start)
|
||||
|
||||
|
||||
def supabase_call():
|
||||
supabase: Client = create_client("SUPABASE_URL", "SUPBASE_SERVICE_ROLE_KEY")
|
||||
start = time.time()
|
||||
result = supabase.table("your_table_name").select("*").execute()
|
||||
stop = time.time()
|
||||
return (stop - start)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ref = psycop_call()
|
||||
sup = supabase_call()
|
||||
print(f"postgres: {ref}, supabase: {sup}, ratio: {sup/ref}")
|
||||
```
|
||||
|
||||
3. You will see that the Supabase client takes longer to execute the same query, especially for smaller tables or queries returning just one row.
|
||||
|
||||
## Expected behavior
|
||||
|
||||
The overhead from PostgREST shouldn't be higher than a few milliseconds at max. 60-70 ms is way too high. This is particular deceiving because one can run the query on the SQL Editor page and it reports the same time as the direct postgres query, which is not what actually happens.
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title = "How can I revoke execution of a PostgreSQL function?"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/17606"
|
||||
date_created = "2023-09-21T03:04:41+00:00"
|
||||
topics = [ "database", "functions" ]
|
||||
keywords = [ "functions", "permissions" ]
|
||||
database_id = "b7edb30b-beee-40ae-9b4f-666ef6411bb6"
|
||||
|
||||
[[errors]]
|
||||
message = "ERROR: permission denied for function foo"
|
||||
---
|
||||
|
||||
All functions access is PUBLIC by default, this means that any role can execute it. To revoke execution, there are 2 steps required:
|
||||
|
||||
- Revoke function execution (`foo` in this case) from PUBLIC:
|
||||
|
||||
```sql
|
||||
revoke execute on function foo from public;
|
||||
```
|
||||
|
||||
- Revoke execution from a particular role (`anon` in this case):
|
||||
|
||||
```sql
|
||||
revoke execute on function foo from anon;
|
||||
```
|
||||
|
||||
Now `anon` should get an error when trying to execute the function:
|
||||
|
||||
```sql
|
||||
begin;
|
||||
set local role anon;
|
||||
select foo();
|
||||
ERROR: permission denied for function foo
|
||||
```
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title = "How do I check GoTrue/API version of a Supabase project?"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/14217"
|
||||
date_created = "2023-05-09T04:21:49+00:00"
|
||||
topics = [ "auth", "platform" ]
|
||||
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'
|
||||
|
||||
{
|
||||
"version": "v2.60.7",
|
||||
"name": "GoTrue",
|
||||
"description": "GoTrue is a user registration and authentication API"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title = "How do I make the cookies HttpOnly?"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/18869"
|
||||
date_created = "2023-11-10T11:49:06+00:00"
|
||||
topics = [ "auth" ]
|
||||
keywords = [ "cookies", "HttpOnly" ]
|
||||
database_id = "cdaa76a4-3e5b-4c8f-82f0-b713c4cf19ab"
|
||||
---
|
||||
|
||||
This is not necessary. Both the access token and refresh token are designed to be passed around to different components in your application. The browser-based side of your application needs access to the refresh token to properly maintain a browser session anyway.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title = "How do I reset my Supabase database password?"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/20929"
|
||||
date_created = "2024-02-01T12:34:59+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "password", "reset" ]
|
||||
database_id = "6e4a515c-5e70-4b92-808c-f076d47d4e35"
|
||||
---
|
||||
|
||||
You can reset your database password from the [database settings page](https://supabase.com/dashboard/project/_/settings/database) on the project dashboard.
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
---
|
||||
title = "How do I update connection pool settings in my dashboard?"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/16787"
|
||||
date_created = "2023-08-24T16:19:11+00:00"
|
||||
topics = [ "database", "supavisor" ]
|
||||
database_id = "dfefd00c-31d8-4969-86a4-03d586110f4c"
|
||||
---
|
||||
|
||||
A few questions I have about updating settings for PgBouncer or Supavisor:
|
||||
|
||||
- How do I know which connection pooler I'm using?
|
||||
|
||||
The PgBouncer connection string looks like: `postgres://postgres:[YOUR-PASSWORD]@db.xxxxxxxxxx.supabase.co:6543/postgres`
|
||||
|
||||
The Supavisor connection string looks like: `postgres://postgres.xxxxxxxxx:[YOUR-PASSWORD]@aws-0-us-west-1.pooler.supabase.com:6543/postgres`
|
||||
|
||||
The subdomain will vary depending on the region a project is deployed in. The project reference is to be included in the username following a `.`. If the username is `postgres` the username you use for Supavisor is `postgres.[PROJECT_REF]`.
|
||||
|
||||
- How do I update the size of the connection pool to the database?
|
||||
|
||||
You can set the `Max Client Connections` field in your database settings here:
|
||||
|
||||
[https://supabase.com/dashboard/project/\_/settings/database](https://supabase.com/dashboard/project/_/settings/database)
|
||||
|
||||
- How do I change the client connection limit?
|
||||
|
||||
You can set the `Default Pool Size` field in your database settings:
|
||||
|
||||
[https://supabase.com/dashboard/project/\_/settings/database](https://supabase.com/dashboard/project/_/settings/database)
|
||||
|
||||
- How do I use `session` mode?
|
||||
|
||||
With Supavisor you can automatically use `session` mode by using the connection string with port `5432` in it.
|
||||
|
||||
You can also set the pooler port 6543 to use `session` mode in the database settings:
|
||||
|
||||
[https://supabase.com/dashboard/project/\_/settings/database](https://supabase.com/dashboard/project/_/settings/database)
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title = "How do you troubleshoot NextJS - Supabase Auth issues?"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/27606"
|
||||
date_created = "2024-06-28T03:26:44+00:00"
|
||||
topics = [ "auth" ]
|
||||
keywords = [ "NextJS", "SSR", "authentication", "client" ]
|
||||
database_id = "4017d331-0b24-439a-9231-793801395ca2"
|
||||
---
|
||||
|
||||
Authentication is hard. SSR is harder. At Supabase, we try to address these together by providing`@supabase/ssr` package to help implement authentication with Supabase conveniently. While I’m targeting to address NextJS-related issues, you can probably apply these concepts to other SSR frameworks such as Nuxt, SvelteKit, and Remix. This is a living document, and we plan to update it regularly as NextJS and its APIs + `@supabase/ssr` evolve.
|
||||
|
||||
If you are experiencing issues with Supabase Auth and SSR, the following checklist will help you troubleshoot the issues.
|
||||
|
||||
✅ You’re on the latest version of `@supabase/ssr` package. Note that the `@supabase/auth-helpers` package is being deprecated, and all the bug fixes and feature releases will be focused on the `@supabase/ssr` package.
|
||||
✅ Do you have all the client utility functions implemented? This way, you can easily import them into your components that need access to Supabase auth functions. Make sure to follow the [guide available here](https://supabase.com/docs/guides/auth/server-side/creating-a-client?queryGroups=framework&framework=nextjs&queryGroups=environment&environment=client-component#creating-a-client) carefully to avoid running into unexpected errors.
|
||||
✅ Do you have the `middleware.ts` file correctly implemented? This lets you refresh expired sessions before loading server components that require a user session for authorization.
|
||||
|
||||
This documentation will help you validate that you’re on the correct path.
|
||||
|
||||
- Setting up Server-Side Auth for Next.js - https://supabase.com/docs/guides/auth/server-side/nextjs?queryGroups=router&router=app
|
||||
- SSR advanced guide - https://supabase.com/docs/guides/auth/server-side/advanced-guide
|
||||
- Creating a Supabase client for SSR - https://supabase.com/docs/guides/auth/server-side/creating-a-client?queryGroups=framework&framework=nextjs&queryGroups=environment&environment=middleware
|
||||
|
||||
Another way to identify any potential issues with your code is to compare it with the Supabase NextJS quickstart. Use the command `npx create-next-app -e with-supabase` to download a copy to your local machine of the quickstart application.
|
||||
|
||||
Our YouTube channel has great videos to help you implement Supabase Auth with Next.js.
|
||||
|
||||
- The Right Way to do Auth with the Next.js App Router - https://youtu.be/v6UvgfSIjQ0?si=TBUN9dD4pmjRg78a
|
||||
|
||||
Also, please take some time to get familiar with some concepts on authentication with NextJS, such as https://nextjs.org/docs/app/building-your-application/authentication.
|
||||
|
||||
We know your requirements vary, and you might run into an edge case. In that scenario, please use our amazing community channels ([GitHub](https://github.com/orgs/supabase/discussions), [Discord](https://discord.gg/rxTfewPvys)) to get help troubleshooting the issue. You can post your issues to the `@supabase/ssr` [GitHub repo](https://github.com/supabase/ssr/issues). We always welcome your contributions!
|
||||
|
||||
If none of the above works, please don’t hesitate to reach out to [Supabase support](https://supabase.help); consider adding more information, such as your use case, code snippets, a copy of your `package.json`, `middleware.ts` and a HAR file, to help the support team triage your issue.
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title = "How long does it take to restore a database from a Point-in-Time backup (PITR)?"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/19527"
|
||||
date_created = "2023-12-08T09:40:51+00:00"
|
||||
keywords = [ "PITR", "restore", "WAL" ]
|
||||
topics = [ "database" ]
|
||||
database_id = "cc852935-510f-4beb-9f70-b4582505a863"
|
||||
---
|
||||
|
||||
The time required for a PIT restoration isn't fixed. It depends on several factors:
|
||||
|
||||
**Time Since Last Full Backup:**
|
||||
|
||||
Full backups occur weekly. The time elapsed since the last full backup can affect restoration time.
|
||||
|
||||
**Write-Ahead Logging (WAL) Activity:**
|
||||
|
||||
The volume of WAL activity since the last full backup is a critical factor. More activity can lead to longer restoration times.
|
||||
|
||||
**Database Size:**
|
||||
|
||||
While important, the size of the database isn't the sole determinant of restoration time.
|
||||
@@ -0,0 +1,162 @@
|
||||
---
|
||||
title = "How Postgres chooses which index to use"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/26959"
|
||||
date_created = "2024-06-03T05:53:16+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "index", "performance", "optimization" ]
|
||||
database_id = "e7671f20-2639-442e-9df9-4f6fa3766598"
|
||||
---
|
||||
|
||||
> For the curious: [here is a list of all built-in indexes in Postgres](https://www.postgresql.org/docs/current/indexes-types.html)
|
||||
|
||||
### Postgres internals
|
||||
|
||||
#### How an index is chosen
|
||||
|
||||
PostgreSQL, internally, contains a few components that manage query execution:
|
||||
|
||||
| Module | Description |
|
||||
| ----------------- | ------------------------------------------------------------------------------------------------------------- |
|
||||
| Parser | Converts SQL into an easily traversable query tree |
|
||||
| Planner/Optimizer | Takes the query tree and uses rules and database statistics to find the optimal strategy for getting the data |
|
||||
| Executor | Executes the plan created by the planner |
|
||||
|
||||
The planner will consider using an index when an indexed column is present in a filter statement, such as:
|
||||
|
||||
- `WHERE`
|
||||
- `LIKE`
|
||||
- `ILIKE`
|
||||
- `DISTINCT`
|
||||
- `SIMILAR TO`
|
||||
- `JOIN`
|
||||
- `ORDER BY`
|
||||
|
||||
Otherwise, it will likely perform a full table scan (sequential scan).
|
||||
|
||||
In the majority of cases, the indexed column must not only be present but also must be filtered by a comparison operator (`=`, `>`, `<>`) that is compatible with the index.
|
||||
|
||||
As an example, one can create the following table:
|
||||
|
||||
| Column Name | Data Type |
|
||||
| ----------- | --------- |
|
||||
| id | INT |
|
||||
| data | JSONB |
|
||||
|
||||
On the data column, a GIN index can be applied, which is excellent for filtering JSONB datatypes:
|
||||
|
||||
```SQL
|
||||
CREATE INDEX some_arbitary_index_name ON some_table USING gin (data);
|
||||
```
|
||||
|
||||
Here's a [link](https://www.postgresql.org/docs/current/gist-builtin-opclasses.html) to the list operators supported by the GIN index; notably, it does not support greater than `>`:
|
||||
|
||||
```sql
|
||||
-- GIN index will never be used
|
||||
select *
|
||||
from some_table
|
||||
where data -> val > 5;
|
||||
```
|
||||
|
||||
GIN does support the `@>` operator:
|
||||
|
||||
```sql
|
||||
--GIN will be considered
|
||||
SELECT id FROM some_table
|
||||
WHERE data @> '[ { "itemId": "p11" } ]';
|
||||
```
|
||||
|
||||
In most cases, developers work with the default BTREE index. It is the most practical and performant in the majority of cases and is compatible with the following filter [operators](https://www.postgresql.org/docs/current/btree-behavior.html):
|
||||
|
||||
| Comparison Operator |
|
||||
| ------------------- |
|
||||
| `<` |
|
||||
| `<=` |
|
||||
| `=` |
|
||||
| `>=` |
|
||||
| `>` |
|
||||
|
||||
An operator's functional equivalents, such as `IN`, `BETWEEN`, and `ANY`, are also valid.
|
||||
|
||||
However, just because the base requirements (relevant column, filter, and operators) are present, doesn't mean that an index will be used.
|
||||
|
||||
Indexes have a startup cost, so for small tables, Postgres might use a sequential scan if it believes that it will take less time. The database keeps statistics about each table that it uses to inform these choices.
|
||||
|
||||
In very rare cases, these statistics can become stale, and Postgres may opt to use a slower index or sequential scan when a better option is available.
|
||||
|
||||
You can see the query plan with the `EXPLAIN` keyword:
|
||||
|
||||
```
|
||||
EXPLAIN <your query>
|
||||
```
|
||||
|
||||
To understand how to interpret its output, you can check out this [explainer](https://github.com/orgs/supabase/discussions/22839).
|
||||
|
||||
To reset statistics within the database, you can use the following query:
|
||||
|
||||
```sql
|
||||
-- use judiciously
|
||||
select pg_stat_reset();
|
||||
```
|
||||
|
||||
### Complex or composite indexes
|
||||
|
||||
> For a more complete rundown, check the [Postgres Official Docs](https://www.postgresql.org/docs/current/indexes-multicolumn.html)
|
||||
|
||||
#### Multi-column indexes
|
||||
|
||||
If you make independent indexes on multiple columns, Postgres will likely use each of them independently to find the relevant rows and then combine the results together.
|
||||
|
||||
It is possible to make [multi-column indexes](https://www.postgresql.org/docs/current/indexes-multicolumn.html). If you are regularly filtering against multiple columns, there can be performance benefits using them instead of several independent indexes.
|
||||
|
||||
```sql
|
||||
-- multi-column index
|
||||
create index test2_mm_idx on test2 (major, minor);
|
||||
|
||||
-- multi-column comparison:
|
||||
select name
|
||||
from test2
|
||||
where major = constant and minor = constant;
|
||||
```
|
||||
|
||||
#### Ordered indexes
|
||||
|
||||
If you're using an ORDER BY clause, [indexes can also be pre-sorted by DESC/ASC](https://www.postgresql.org/docs/current/indexes-ordering.html) for better performance.
|
||||
|
||||
```
|
||||
-- organizes the index in a DESC order, places NULL values at the end
|
||||
CREATE INDEX test3_desc_index ON test3 (id DESC NULLS LAST);
|
||||
```
|
||||
|
||||
#### Functional indexes
|
||||
|
||||
Although not as common, indexes can also be leveraged against modified values, such as when using a LOWER function:
|
||||
|
||||
```sql
|
||||
-- Index on modified column through function
|
||||
create index test1_lower_col1_idx on test1 (lower(col1));
|
||||
|
||||
-- Index will be considered for the following query:
|
||||
select * from test1 where lower(col1) = 'value';
|
||||
```
|
||||
|
||||
#### Covering indexes
|
||||
|
||||
Indexes contain pointers to a specific row, but you could instruct an index to actually hold a copy of a column's value for even faster retrieval. These are known as `covering` indexes. Because maintaining a copy is storage intensive, you should avoid using it for values with large data footprints.[ FULL VIDEO ON TOPIC](https://www.youtube.com/watch?v=bBu_V8CfWgM)
|
||||
|
||||
```sql
|
||||
CREATE INDEX a_b_idx ON x (a,b) INCLUDE (c);
|
||||
```
|
||||
|
||||
#### Indexes on JSONB
|
||||
|
||||
Although a GIN/GIST index can be used to index entire JSONB bodies, you can also target just specific Key-values with standard BTREE indexes:
|
||||
|
||||
```sql
|
||||
-- Example table
|
||||
create table person (
|
||||
id serial primary key,
|
||||
data jsonb
|
||||
);
|
||||
|
||||
create index index_name on person ((data ->> 'name'));
|
||||
```
|
||||
@@ -0,0 +1,107 @@
|
||||
---
|
||||
title = "How to change max database connections"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/27197"
|
||||
date_created = "2024-06-12T02:49:15+00:00"
|
||||
topics = [ "database", "supavisor", "cli" ]
|
||||
keywords = [ "connections", "postgres", "memory", "cpu" ]
|
||||
database_id = "78f06ca5-6a69-4536-89fc-ed2e6ff334e5"
|
||||
|
||||
[api]
|
||||
cli = [ "supabase-postgres-config-update" ]
|
||||
---
|
||||
|
||||
> WARNING: Manually configuring the connection count hard codes it. This means if you upgrade or downgrade your database, the connection count will not auto-resize. You will have to make sure to manually update it.
|
||||
|
||||
# Changing max database connections:
|
||||
|
||||
Each compute instance has a default direct connection and pooler connection settings. You can find the most recent settings in the [compute docs](https://supabase.com/docs/guides/platform/compute-add-ons#disk-io):
|
||||
|
||||
| Compute Size | Direct Connections | Pooler Connections |
|
||||
| ------------ | ------------------ | ------------------ |
|
||||
| Nano (free) | 60 | 200 |
|
||||
| Micro | 60 | 200 |
|
||||
| Small | 90 | 400 |
|
||||
| Medium | 120 | 600 |
|
||||
| Large | 160 | 800 |
|
||||
| XL | 240 | 1,000 |
|
||||
| 2XL | 380 | 1,500 |
|
||||
| 4XL | 480 | 3,000 |
|
||||
| 8XL | 490 | 6,000 |
|
||||
| 12XL | 500 | 9,000 |
|
||||
| 16XL | 500 | 12,000 |
|
||||
|
||||
## Configuring direct connections limits
|
||||
|
||||
> Note: the Supavisor connection limits are hard-coded and cannot be changed without upgrading the compute size:
|
||||
|
||||
You can configure the maximum amount of connections that Postgres will tolerate with the [Supabase CLI.](https://supabase.com/docs/guides/platform/custom-postgres-config)
|
||||
|
||||
You can run the following commands:
|
||||
|
||||
```sh
|
||||
npx supabase login
|
||||
|
||||
npx supabase --experimental --project-ref <PROJECT REF> postgres-config update --config max_connections=<INTEGER VALUE>
|
||||
```
|
||||
|
||||
Then you could run the following SQL in the SQL Editor to see if the changes went through:
|
||||
|
||||
```sql
|
||||
SHOW max_connections;
|
||||
```
|
||||
|
||||
# Dangers of increasing the direct connection limits
|
||||
|
||||
**Three** factors must be taken into consideration when adjusting the direct connection limit:
|
||||
|
||||
### Process schedulers and Postgres internals:
|
||||
|
||||
Allowing too many direct connections in your database can overburden Postgres schedulers and other internal modules. This will result in a noticeable decrease in query throughput, despite having more connections available. EnterpriseDB wrote a wonderful [article](https://www.enterprisedb.com/postgres-tutorials/why-you-should-use-connection-pooling-when-setting-maxconnections-postgres) that outlines some of the considerations.
|
||||
|
||||
The default connection values are set based on a solid understanding of Postgres architecture, and straying too far from them is _likely_ to hinder performance. However, with some experimentation, you might discover a value better suited to your specific needs. Still, unless there's a compelling reason to adjust the setting, it's generally advisable to stick with the defaults or change the values judiciously.'
|
||||
|
||||
### Memory
|
||||
|
||||
> If you do not know how to monitor memory and CPU with Supabase Grafana, [check here](https://github.com/orgs/supabase/discussions/27141).
|
||||
|
||||
#### Each direct connection is a running process that will consume active memory
|
||||
|
||||
This is a Grafana Chart of unhealthy memory usage:
|
||||
|
||||

|
||||
|
||||
- Yellow: represents active memory
|
||||
- Red: represents SWAP, which is disk storage that the system treats as if it were actually memory
|
||||
- Green: it is unclaimed (the system will always leave some memory unclaimed)
|
||||
- Blue: it is cached data and a buffer
|
||||
|
||||
The cache in PostgreSQL is important because the database will store frequently accessed data in it for rapid retrieval. If too much active memory is needed, it runs the risk of excessively displacing cache. This will force queries to check disk, which is slow.
|
||||
|
||||
Most data in a database is idle. However, when there is little available memory or uncached data is rapidly accessed, [thrashing](<https://en.wikipedia.org/wiki/Thrashing_(computer_science)>) can occur.
|
||||
|
||||
To avoid displacing cache or straining system resources, it is advised to not increase your direct connections unless you have a clear excess of unclaimed memory (green).
|
||||
|
||||
Postgres will allow you to overcommit memory. You can run the below query to find out the hypothetical max value you could change it to without risking memory failure:
|
||||
|
||||
> NOTE: You can find your server memory in the [compute add-ons docs](https://supabase.com/docs/guides/platform/compute-add-ons)
|
||||
|
||||
```sql
|
||||
select
|
||||
'(SERVER MEMORY - ' || current_setting('shared_buffers') || ' - (' || current_setting(
|
||||
'autovacuum_max_workers'
|
||||
) || ' * ' || current_setting('maintenance_work_mem') || ')) / ' || current_setting('work_mem');
|
||||
```
|
||||
|
||||
### CPU
|
||||
|
||||
The below chart is an example of what can occur to the CPU if 100s of connections are inappropriately opened/closed every second or many CPU intensive queries are run in parallel
|
||||
|
||||

|
||||
|
||||
If you plan on increasing your direct connection numbers, your database should have relatively predictable or low CPU usage, such as what the example displays below:
|
||||
|
||||
<img
|
||||
width="706"
|
||||
alt="Screenshot 2024-06-11 at 3 09 03 PM"
|
||||
src="https://github.com/supabase/supabase/assets/91111415/ee3e4f4c-87a1-4ef8-9ca5-af9094fc1b93"
|
||||
/>
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
---
|
||||
title = "How to check if my queries are being blocked by other queries?"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/19681"
|
||||
date_created = "2023-12-13T15:56:12+00:00"
|
||||
topics = [ "database" ]
|
||||
database_id = "990ed738-2e00-42ce-9892-77c16f870cdc"
|
||||
---
|
||||
|
||||
## You can set a lock monitor view to help investigate these.
|
||||
|
||||
Once you run the query that takes a long time to complete, you can go in the dashboard (or select from this view below) to check what are the blocks.
|
||||
|
||||
```sql
|
||||
create view
|
||||
public.lock_monitor as
|
||||
select
|
||||
coalesce(
|
||||
blockingl.relation::regclass::text,
|
||||
blockingl.locktype
|
||||
) as locked_item,
|
||||
now() - blockeda.query_start as waiting_duration,
|
||||
blockeda.pid as blocked_pid,
|
||||
blockeda.query as blocked_query,
|
||||
blockedl.mode as blocked_mode,
|
||||
blockinga.pid as blocking_pid,
|
||||
blockinga.query as blocking_query,
|
||||
blockingl.mode as blocking_mode
|
||||
from
|
||||
pg_locks blockedl
|
||||
join pg_stat_activity blockeda on blockedl.pid = blockeda.pid
|
||||
join pg_locks blockingl on (
|
||||
blockingl.transactionid = blockedl.transactionid
|
||||
or blockingl.relation = blockedl.relation
|
||||
and blockingl.locktype = blockedl.locktype
|
||||
)
|
||||
and blockedl.pid <> blockingl.pid
|
||||
join pg_stat_activity blockinga on blockingl.pid = blockinga.pid
|
||||
and blockinga.datid = blockeda.datid
|
||||
where
|
||||
not blockedl.granted
|
||||
and blockinga.datname = current_database();
|
||||
```
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title = "How to delete a role in Postgres"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/27427"
|
||||
date_created = "2024-06-20T19:21:11+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "role", "delete", "postgres" ]
|
||||
database_id = "085d7649-0b5d-4c3c-b6a1-f2da4b9f33dd"
|
||||
|
||||
[[errors]]
|
||||
message = "a role cannot be removed while it is still referenced in any database of the cluster"
|
||||
---
|
||||
|
||||
[Quote from postgres docs:](https://www.postgresql.org/docs/current/sql-droprole.html#:~:text=A%20role%20cannot%20be%20removed,been%20granted%20on%20other%20objects.)
|
||||
|
||||
> A role cannot be removed if it is still referenced in any database of the cluster; an error will be raised if so. Before dropping the role, you must drop all the objects it owns (or reassign their ownership) and revoke any privileges the role has been granted on other objects.
|
||||
|
||||
First make sure that Postgres has ownership over the role:
|
||||
|
||||
```sql
|
||||
GRANT <role> TO "postgres";
|
||||
```
|
||||
|
||||
Then you must reassign any objects owned by role:
|
||||
|
||||
```sql
|
||||
REASSIGN OWNED BY <role> TO postgres;
|
||||
```
|
||||
|
||||
Once ownership is transferred, you can run the following query:
|
||||
|
||||
```sql
|
||||
DROP OWNED BY <role>;
|
||||
```
|
||||
|
||||
[DROP OWNED BY](https://www.postgresql.org/docs/current/sql-drop-owned.html) does delete all objects owned by the role, which should be none. However, it also revokes the role's privileges. Once this is done, you should be able to run:
|
||||
|
||||
```sql
|
||||
DROP role <role>;
|
||||
```
|
||||
|
||||
If you encounter any issues, please create a [support ticket](https://supabase.com/dashboard/support/new)
|
||||
+402
@@ -0,0 +1,402 @@
|
||||
---
|
||||
title = "How to Interpret and Explore the Postgres Logs"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/26224"
|
||||
date_created = "2024-05-12T21:19:37+00:00"
|
||||
topics = [ "database", "platform" ]
|
||||
database_id = "8b000bb4-180b-4a6c-b280-ba02965060f6"
|
||||
---
|
||||
|
||||
> A complimentary guide was made for the [API logs](https://github.com/orgs/supabase/discussions/22849)
|
||||
|
||||
# Debugging and monitoring Postgres with logs
|
||||
|
||||
Logs provide insights into Postgres operations. They help meet compliance requirements, detect suspicious activity, and troubleshoot problems.
|
||||
|
||||
## Table of contents
|
||||
|
||||
- Querying Logs
|
||||
- `postgres_logs` Table Structure
|
||||
- Filtering Logs
|
||||
- Routine Events
|
||||
- By Timeframe
|
||||
- By Error Severity
|
||||
- By Query
|
||||
- By APIs/Roles
|
||||
- By Supabase Dashboard Queries
|
||||
- Full Example For Finding Errors
|
||||
- Logging for Compliance and Security
|
||||
- Reviewing Log Settings
|
||||
- Changing Log Settings
|
||||
- Severity levels
|
||||
- Configuring queries logged
|
||||
- Logging within functions
|
||||
- Frequently Asked Questions
|
||||
- Other resources
|
||||
|
||||
## Querying logs
|
||||
|
||||
The most practical way to explore and filter logs is through the [Logs Explorer](https://supabase.com/dashboard/project/_/logs/explorer).
|
||||
|
||||
It uses a subset of Bigquery SQL syntax and preparses queries for optimization. This imposes three primary limitations:
|
||||
|
||||
- No subqueries or `WITH` statements
|
||||
- No `*` wildcards for column names
|
||||
- No `ILIKE` statements
|
||||
|
||||
Although there are many strategies to filter logs, such as `like` and `in` statements, a helper function called [`regexp_contains`](https://github.com/orgs/supabase/discussions/22640) provides the most flexibility and control.
|
||||
|
||||
The `postgres_logs` table contains Postgres events.
|
||||
|
||||
### `postgres_logs` table structure
|
||||
|
||||
The table contains 3 fundamental columns:
|
||||
|
||||
| column | description |
|
||||
| --------------- | ----------------------- |
|
||||
| event_message | the log's message |
|
||||
| timestamp | time event was recorded |
|
||||
| parsed metadata | metadata about event |
|
||||
|
||||
The parsed metadata column is an array that contains relevant information about events. To access the information, it must be unnested. This is done with a `cross join`.
|
||||
|
||||
**Unnesting example**
|
||||
|
||||
```sql
|
||||
select
|
||||
event_message,
|
||||
parsed.<column name>
|
||||
from
|
||||
postgres_logs
|
||||
-- Unpack data stored in the 'metadata' field
|
||||
cross join unnest(metadata) AS metadata
|
||||
-- After unpacking the 'metadata' field, extract the 'parsed' field from it
|
||||
cross join unnest(parsed) AS parsed;
|
||||
```
|
||||
|
||||
### Parsed metadata fields
|
||||
|
||||
#### Query information
|
||||
|
||||
| Field | Description | Example |
|
||||
| --------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------- |
|
||||
| parsed.query | The SQL query executed | `SELECT * FROM table;` |
|
||||
| parsed.command_tag | Tag identifying the type of command (e.g., SELECT) | `SELECT`, `INSERT`, `UPDATE`... |
|
||||
| parsed.internal_query | An internal query that is used to facilitate a primary query. Often used by realtime for certain tasks | `select to_jsonb()` |
|
||||
|
||||
**Suggested use cases:**
|
||||
|
||||
- Identifying slow queries
|
||||
- Identifying failing queries
|
||||
|
||||
#### Error/Warning information
|
||||
|
||||
| Field | Description | Example |
|
||||
| --------------------- | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
|
||||
| parsed.error_severity | [event severity](#severity-levels) | `LOG`, `WARNING`, `ERROR`... |
|
||||
| parsed.detail | Explanation of the event according to Postgres | "Key (fk_table)=(553585367) already exists." |
|
||||
| parsed.sql_state_code | An error code that maps to Postgres's error table | `42501` |
|
||||
| parsed.hint | Hint on how to solve the error | "No function matches the given name and argument types. You might need to add explicit type casts." |
|
||||
| parsed.context | Provides insight into where an error may have occurred | "PL/pgSQL function public.find_text(public.vector,integer) line 3 at IF" |
|
||||
|
||||
**Suggested use cases:**
|
||||
|
||||
- Filter by error severity or sql code
|
||||
- Get hints, details, and context about error events
|
||||
|
||||
#### Connection/Identification information
|
||||
|
||||
| Field | Description | Example |
|
||||
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
|
||||
| parsed.session_id | The session ID | 12345 |
|
||||
| parsed.session_start_time | The start time of the session | 2024-05-08 15:30:00 |
|
||||
| parsed.connection_from | The connection IP | 192.165.1.100 |
|
||||
| parsed.user_name | The name of the connecting database user | postgres |
|
||||
| parsed.application_name | The name of the application | Supavisor, postgREST |
|
||||
| parsed.database_name | The name of the database | postgres |
|
||||
| parsed.process_id | The process ID, often used to identify extension workers | 1234 |
|
||||
| parsed.backend_type | Determine if the event originated internally (e.g., from background workers like pg_net, timescale, or pg_cron) or externally from a client (`client backend`) | `client backend` |
|
||||
|
||||
**Suggested use cases:**
|
||||
|
||||
- Identify events by server/API
|
||||
- Filter connections by IP
|
||||
- Identify connections to specific databases
|
||||
- Filter connections by sessions for debugging
|
||||
- identify extension events
|
||||
|
||||
## Filtering logs
|
||||
|
||||
### Excluding routine events
|
||||
|
||||
Most Postgres logs during normal periods are routine events, such as connection authorizations and checkpoints. To see the default types of events that are logged, you can check this [guide](https://gist.github.com/TheOtherBrian1/991d32c2b00dbc75d29b80d4cdf41aa7).
|
||||
|
||||
When exploring the logs for atypical behavior, it's often strategic to filter out expected values. This can be done by adding the following filter to your queries:
|
||||
|
||||
```sql
|
||||
...query
|
||||
where
|
||||
-- Excluding routine events related to cron, PgBouncer, checkpoints, and successful connections
|
||||
not regexp_contains(event_message, '^cron|PgBouncer|checkpoint|connection received|authenticated|authorized';
|
||||
```
|
||||
|
||||
### By timeframe
|
||||
|
||||
To investigate issues around a specific period:
|
||||
|
||||
```sql
|
||||
-- filtering by time period
|
||||
...query
|
||||
where
|
||||
timestamp between '2024-05-06 04:44:00' and '2024-05-06 04:45:00'
|
||||
```
|
||||
|
||||
### By error severity
|
||||
|
||||
This filter finds all errors, fatals, and panics:
|
||||
|
||||
| Severity | Usage |
|
||||
| -------- | ------------------------------------------------------------ |
|
||||
| ERROR | Reports an error that caused the current command to abort. |
|
||||
| FATAL | Reports an error that caused the current session to abort. |
|
||||
| PANIC | Reports an error that caused all database sessions to abort. |
|
||||
|
||||
```sql
|
||||
-- find error events
|
||||
... query
|
||||
where
|
||||
parsed.error_severity in ('ERROR', 'FATAL', 'PANIC')
|
||||
```
|
||||
|
||||
Failure events include an sql_state_code that can be referenced in the [Postgres Docs](https://www.postgresql.org/docs/current/errcodes-appendix.html)
|
||||
|
||||
### By query
|
||||
|
||||
> NOTE: Unless pg_audit is configured, only failed queries are logged
|
||||
|
||||
```
|
||||
-- find queries executed by the Dashboard
|
||||
...query
|
||||
where
|
||||
regexp_contains(parsed.query, '(?i)select . <some table>')
|
||||
```
|
||||
|
||||
Queries can use complex syntax, so it is often helpful to isolate by referenced database objects, such as `functions`, `tables`, and `columns`. Because query structures can be complex, it is advised to use [regex](https://github.com/orgs/supabase/discussions/22640) to find matches. Some common regex patterns are:
|
||||
|
||||
- `(?i)`: ignore case sensitivty
|
||||
- `.`: wildcard
|
||||
- `^`: look for values at start of string
|
||||
- `|`: or operator
|
||||
|
||||
## By APIs/roles
|
||||
|
||||
All failed queries, including those from PostgREST, Auth, and external libraries (e.g., Prisma) are logged with helpful error messages for debugging.
|
||||
|
||||
#### Server/Role mapping
|
||||
|
||||
API servers have assigned database roles for connecting to the database:
|
||||
|
||||
| Role | API/Tool |
|
||||
| -------------------------- | ------------------------------------------------------------------------- |
|
||||
| supabase_admin | Used by Supabase to configure projects and for monitoring |
|
||||
| authenticator | PostgREST |
|
||||
| supabase_auth_admin | Auth |
|
||||
| supabase_storage_admin | Storage |
|
||||
| supabase_realtime_admin | Realtime |
|
||||
| supabase_replication_admin | Synchronizes Read Replicas |
|
||||
| postgres | Supabase Dashboard and External Tools (e.g., Prisma, SQLAlchemy, PSQL...) |
|
||||
| Custom roles | External Tools (e.g., Prisma, SQLAlchemy, PSQL...) |
|
||||
|
||||
Filter by the `parsed.user_name` role to only retrieve logs made by specific roles:
|
||||
|
||||
```sql
|
||||
-- find events based on role/server
|
||||
... query
|
||||
where
|
||||
-- find events from the relevant role
|
||||
parsed.user_name = '<ROLE>'
|
||||
...
|
||||
```
|
||||
|
||||
## By Dashboard queries
|
||||
|
||||
Queries from the Supabase Dashboard are executed under the postgres role and include the comment `-- source: dashboard`. To isolate or exclude Dashboard requests during debugging, you can filter by this comment.
|
||||
|
||||
```sql
|
||||
-- find queries executed by the Dashboard
|
||||
...query
|
||||
where
|
||||
regexp_contains(parsed.query, '-- source: dashboard')
|
||||
```
|
||||
|
||||
## Full example for finding errors
|
||||
|
||||
```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
|
||||
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 parsed.user_name = 'postgres'
|
||||
and regexp_contains(event_message, 'duration|operator')
|
||||
and not regexp_contains(parsed.query, '<key words>')
|
||||
and postgres_logs.timestamp between '2024-04-15 10:50:00' and '2024-04-15 10:50:27'
|
||||
order by timestamp desc
|
||||
limit 100;
|
||||
```
|
||||
|
||||
# Logging for compliance and security
|
||||
|
||||
### Customized object and role activity logging
|
||||
|
||||
> ⚠️ NOTE: This is specifically designated for those using the `postgres` role or [custom roles](https://supabase.com/docs/guides/database/postgres/roles) to interact with their database. Those utilizing the Database REST API should reference the [Database API Logging Guide](https://github.com/orgs/supabase/discussions/22849) instead.
|
||||
|
||||
When recording what is accessed and by whom, logging based on database roles and objects is the most reliable way to ensure a proper trail of activity.
|
||||
|
||||
You can use the [pg_audit](https://supabase.com/docs/guides/database/extensions/pgaudit) extension to selectively log relevant queries (not just errors) by certain roles, against specific database objects.
|
||||
|
||||
You should take care when using the extension to not log all database events, but only what is absolutely necessary. Overlogging can strain the database and create log noise that makes it difficult to filter for relevant events.
|
||||
|
||||
**Filtering by pg_audit**:
|
||||
|
||||
```sql
|
||||
... query
|
||||
where
|
||||
-- all pg_audit recorded events start with 'AUDIT'
|
||||
regexp_contains(event_message, '^AUDIT')
|
||||
and
|
||||
-- Finding queries executed from the relevant role (e.g., 'API_role')
|
||||
parsed.user_name = 'API_role'
|
||||
```
|
||||
|
||||
### Filtering by IP
|
||||
|
||||
> If you are connecting from a known, limited range of IP addresses, you should enable [network restrictions](https://supabase.com/docs/guides/platform/network-restrictions).
|
||||
|
||||
Monitoring IPs becomes tricky when dealing with dynamic addressing, such as those from serverless or edge environments. This challenge amplifies when relying on certain poolers, such as Prisma Accelerate, Supavisor, or Cloudflare's Hyperdrive, as they record the pooler's IP, not the true origin.
|
||||
|
||||
IP tracking is most effective when consistently relying on direct database connections from servers with static IP addresses:
|
||||
|
||||
```sql
|
||||
-- filter by IP
|
||||
select
|
||||
event_message,
|
||||
connection_from as ip,
|
||||
count(connection_from) as ip_count
|
||||
from
|
||||
postgres_logs
|
||||
cross join unnest(metadata) as metadata
|
||||
cross join unnest(parsed) as parsed
|
||||
where
|
||||
regexp_contains(user_name, '<ROLE>')
|
||||
and regexp_contains(backend_type, 'client backend') -- only search for connections from outside the database (excludes cron jobs)
|
||||
and regexp_contains(event_message, '^connection authenticated') -- only view successful authentication events
|
||||
group by connection_from, event_message
|
||||
order by ip_count desc
|
||||
limit 100;
|
||||
```
|
||||
|
||||
# Reviewing log settings
|
||||
|
||||
The `pg_settings` table describes system and logging configurations.
|
||||
|
||||
```sql
|
||||
-- view system variables
|
||||
select * from pg_settings;
|
||||
```
|
||||
|
||||
The settings that affect logs are categorized under:
|
||||
| Category | Description |
|
||||
|----------|-------------|
|
||||
| `Reporting and Logging / What to Log` | Specifies system events worth logging.|
|
||||
| `Reporting and Logging / When to Log` | Specifies certain conditions or rules for logging
|
||||
| `Customized Options` | Configures extensions and loaded modules, including those enhancing logging like auto_explain and pg_audit. |
|
||||
|
||||
To view all log settings for your database, you can execute the following SQL:
|
||||
|
||||
```sql
|
||||
-- view all log related settings
|
||||
select *
|
||||
from pg_settings
|
||||
where
|
||||
(
|
||||
category like 'Reporting and Logging / What to Log'
|
||||
or category like 'Reporting and Logging / When to Log'
|
||||
or category = 'Customized Options'
|
||||
)
|
||||
and name like '%log%';
|
||||
```
|
||||
|
||||
## Changing log settings
|
||||
|
||||
> WARNING: lenient settings can lead to overlogging, impacting database performance while creating noise in the logs.
|
||||
|
||||
#### Severity levels
|
||||
|
||||
The `log_min_messages` variable determines what is severe enough to log. Here are the severity thresholds from the [Postgres docs](https://www.postgresql.org/docs/current/runtime-config-logging.html).
|
||||
|
||||
| Severity | Usage |
|
||||
| ---------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| DEBUG1 .. DEBUG5 | Provides successively-more-detailed information for use by developers. |
|
||||
| INFO | Provides information implicitly requested by the user, e.g., output from VACUUM VERBOSE. |
|
||||
| NOTICE | Provides information that might be helpful to users, e.g., notice of truncation of long identifiers. |
|
||||
| WARNING | Provides warnings of likely problems, e.g., COMMIT outside a transaction block. |
|
||||
| ERROR | Reports an error that caused the current command to abort. |
|
||||
| LOG | Reports information of interest to administrators, e.g., checkpoint activity. |
|
||||
| FATAL | Reports an error that caused the current session to abort. |
|
||||
| PANIC | Reports an error that caused all database sessions to abort. |
|
||||
|
||||
In most cases, the default is adequate. However, if you must adjust the setting, you can do so with the following query:
|
||||
|
||||
```sql
|
||||
alter role postgres set log_min_messages = '<NEW VALUE>';
|
||||
|
||||
-- view new setting
|
||||
show log_min_messages; -- default WARNING
|
||||
```
|
||||
|
||||
#### Configuring queries logged
|
||||
|
||||
By default, only failed queries are logged. The [PGAudit extension](https://supabase.com/docs/guides/database/extensions/pgaudit) extends Postgres's built-in logging abilities. It can be used to selectively track all queries in your database by:
|
||||
|
||||
- role
|
||||
- session
|
||||
- database object
|
||||
- entire database
|
||||
|
||||
#### Logging within database functions
|
||||
|
||||
To track or debug functions, logging can be configured by followin the [function debugging guide](https://supabase.com/docs/guides/database/functions#general-logging)
|
||||
|
||||
# Frequently Asked Questions
|
||||
|
||||
#### Can I join together different log tables, such as `edge_logs` and `postgres_logs`?
|
||||
|
||||
No, log tables are independent from each other and do not share any primary/foreign key relations for joining.
|
||||
|
||||
#### Can I download the logs?
|
||||
|
||||
At the moment, the way to download logs is through the Log Dashboard as a CSV
|
||||
|
||||
#### What is logged?
|
||||
|
||||
To see the default types of events that are logged, you can check this [guide](https://gist.github.com/TheOtherBrian1/991d32c2b00dbc75d29b80d4cdf41aa7).
|
||||
|
||||
### Other resources:
|
||||
|
||||
- [Regex for filtering logs](https://github.com/orgs/supabase/discussions/22640)
|
||||
- [Debugging with the DB API logs](https://github.com/orgs/supabase/discussions/22849)
|
||||
- [Debugging Database Functions](https://supabase.com/docs/guides/database/functions#debugging-functions)
|
||||
- [pg_audit](https://supabase.com/docs/guides/database/extensions/pgaudit)
|
||||
- [Supabase Logging](https://supabase.com/docs/guides/platform/logs)
|
||||
- [Self-Hosting Logs](https://supabase.com/docs/reference/self-hosting-analytics/introduction)
|
||||
+316
@@ -0,0 +1,316 @@
|
||||
---
|
||||
title = "How to Migrate from Supabase Auth Helpers to SSR package"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/27849"
|
||||
date_created = "2024-07-07T17:24:30+00:00"
|
||||
topics = [ "auth" ]
|
||||
keywords = [ "migration", "auth", "ssr", "package" ]
|
||||
database_id = "273b79ad-b8ff-4669-8544-b99920e2d3c8"
|
||||
---
|
||||
|
||||
The `auth-helpers` packages are being deprecated and replaced with the `@supabase/ssr` package. We recommend migrating to the `@supabase/ssr` package as future bug fixes and feature releases are focused on the `@supabase/ssr` package.
|
||||
|
||||
Here are the steps for you to migrate your application from the `auth-helpers` package to `@supabase/ssr` package.
|
||||
|
||||
Depending on your implementation, you may ignore some parts of this documentation and use your own implementation (i.e. using API routes vs. Server Actions). What’s important is you replace the clients provided by `auth-helpers` with the utility functions created using clients provided by `@supabase/ssr`.
|
||||
|
||||
### 1. Uninstall Supabase Auth helpers and install the Supabase SSR package
|
||||
|
||||
It’s important that you don’t use both `auth-helpers-nextjs` and `@supabase/ssr` packages in the same application to avoid running into authentication issues.
|
||||
|
||||
```
|
||||
npm uninstall @supabase/auth-helpers-nextjs @supabase/supabase-js
|
||||
npm install @supabase/ssr @supabase/supabase-js
|
||||
```
|
||||
|
||||
### 2. Create the utility functions to create Supabase clients.
|
||||
|
||||
```
|
||||
// utils/supabase/client.ts
|
||||
|
||||
import { createBrowserClient } from '@supabase/ssr';
|
||||
|
||||
export function createClient() {
|
||||
return createBrowserClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
||||
);
|
||||
}
|
||||
|
||||
// utils/supabase/server.ts
|
||||
import { createServerClient, type CookieOptions } from '@supabase/ssr';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
export function createClient() {
|
||||
const cookieStore = cookies();
|
||||
|
||||
return createServerClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
||||
{
|
||||
cookies: {
|
||||
getAll() {
|
||||
return cookieStore.getAll()
|
||||
},
|
||||
setAll(cookiesToSet) {
|
||||
try {
|
||||
cookiesToSet.forEach(({ name, value, options }) =>
|
||||
cookieStore.set(name, value, options)
|
||||
)
|
||||
} catch {
|
||||
// The `setAll` method was called from a Server Component.
|
||||
// This can be ignored if you have middleware refreshing
|
||||
// user sessions.
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// utils/supabase/middleware.ts
|
||||
import { createServerClient } from '@supabase/ssr';
|
||||
import { NextResponse, type NextRequest } from 'next/server';
|
||||
|
||||
export async function updateSession(request: NextRequest) {
|
||||
let supabaseResponse = NextResponse.next({
|
||||
request,
|
||||
});
|
||||
|
||||
const supabase = createServerClient(
|
||||
process.env.NEXT_PUBLIC_SUPABASE_URL!,
|
||||
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
|
||||
{
|
||||
cookies: {
|
||||
getAll() {
|
||||
return request.cookies.getAll()
|
||||
},
|
||||
setAll(cookiesToSet) {
|
||||
cookiesToSet.forEach(({ name, value, options }) => request.cookies.set(name, value))
|
||||
supabaseResponse = NextResponse.next({
|
||||
request,
|
||||
})
|
||||
cookiesToSet.forEach(({ name, value, options }) =>
|
||||
supabaseResponse.cookies.set(name, value, options)
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// IMPORTANT: Avoid writing any logic between createServerClient and
|
||||
// supabase.auth.getUser(). A simple mistake could make it very hard to debug
|
||||
// issues with users being randomly logged out.
|
||||
|
||||
const {
|
||||
data: { user },
|
||||
} = await supabase.auth.getUser();
|
||||
|
||||
if (
|
||||
!user &&
|
||||
!request.nextUrl.pathname.startsWith('/login') &&
|
||||
!request.nextUrl.pathname.startsWith('/auth')
|
||||
) {
|
||||
// no user, potentially respond by redirecting the user to the login page
|
||||
const url = request.nextUrl.clone();
|
||||
url.pathname = '/login';
|
||||
return NextResponse.redirect(url);
|
||||
}
|
||||
|
||||
// IMPORTANT: You *must* return the supabaseResponse object as it is. If you're
|
||||
// creating a new response object with NextResponse.next() make sure to:
|
||||
// 1. Pass the request in it, like so:
|
||||
// const myNewResponse = NextResponse.next({ request })
|
||||
// 2. Copy over the cookies, like so:
|
||||
// myNewResponse.cookies.setAll(supabaseResponse.cookies.getAll())
|
||||
// 3. Change the myNewResponse object to fit your needs, but avoid changing
|
||||
// the cookies!
|
||||
// 4. Finally:
|
||||
// return myNewResponse
|
||||
// If this is not done, you may be causing the browser and server to go out
|
||||
// of sync and terminate the user's session prematurely!
|
||||
|
||||
return supabaseResponse;
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Replace your middleware.ts file
|
||||
|
||||
```
|
||||
// middleware.ts
|
||||
|
||||
import { type NextRequest } from 'next/server';
|
||||
import { updateSession } from '@/utils/supabase/middleware';
|
||||
|
||||
export async function middleware(request: NextRequest) {
|
||||
return await updateSession(request);
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
/*
|
||||
* Match all request paths except for the ones starting with:
|
||||
* - _next/static (static files)
|
||||
* - _next/image (image optimization files)
|
||||
* - favicon.ico (favicon file)
|
||||
* Feel free to modify this pattern to include more paths.
|
||||
*/
|
||||
'/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
### 4. Create your server actions to handle login and sign up.
|
||||
|
||||
```
|
||||
// app/login/actions.ts
|
||||
|
||||
'use server';
|
||||
|
||||
import { revalidatePath } from 'next/cache';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
import { createClient } from '@/utils/supabase/server';
|
||||
|
||||
export async function login(formData: FormData) {
|
||||
const supabase = createClient();
|
||||
|
||||
// type-casting here for convenience
|
||||
// in practice, you should validate your inputs
|
||||
const data = {
|
||||
email: formData.get('email') as string,
|
||||
password: formData.get('password') as string,
|
||||
};
|
||||
|
||||
const { error } = await supabase.auth.signInWithPassword(data)
|
||||
|
||||
if (error) {
|
||||
redirect('/error');
|
||||
}
|
||||
|
||||
revalidatePath('/', 'layout');
|
||||
redirect('/');
|
||||
}
|
||||
|
||||
export async function signup(formData: FormData) {
|
||||
const supabase = createClient();
|
||||
|
||||
// type-casting here for convenience
|
||||
// in practice, you should validate your inputs
|
||||
const data = {
|
||||
email: formData.get('email') as string,
|
||||
password: formData.get('password') as string,
|
||||
};
|
||||
|
||||
const { error } = await supabase.auth.signUp(data);
|
||||
|
||||
if (error) {
|
||||
redirect('/error');
|
||||
}
|
||||
|
||||
revalidatePath('/', 'layout');
|
||||
redirect('/');
|
||||
}
|
||||
```
|
||||
|
||||
### 5. Utilize the server actions in your login page UI.
|
||||
|
||||
```
|
||||
// app/login/page.tsx
|
||||
|
||||
import { login, signup } from './actions';
|
||||
|
||||
export default function LoginPage() {
|
||||
return (
|
||||
<form>
|
||||
<label htmlFor="email">Email:</label>
|
||||
<input id="email" name="email" type="email" required />
|
||||
<label htmlFor="password">Password:</label>
|
||||
<input id="password" name="password" type="password" required />
|
||||
<button formAction={login}>Log in</button>
|
||||
<button formAction={signup}>Sign up</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### 6. Client components
|
||||
|
||||
```
|
||||
'use client';
|
||||
|
||||
// replace this line
|
||||
import { createClientComponentClient } from '@supabase/auth-helpers-nextjs';
|
||||
|
||||
// with
|
||||
import { createClient } from '@/utils/supabase/client';
|
||||
|
||||
export default async function Page() {
|
||||
// replace this line
|
||||
const supabase = createClientComponentClient<Database>();
|
||||
|
||||
// with
|
||||
const supabase = createClient();
|
||||
|
||||
return...
|
||||
}
|
||||
```
|
||||
|
||||
### 7. Server components
|
||||
|
||||
```
|
||||
// replace
|
||||
import { cookies } from 'next/headers';
|
||||
import { createServerComponentClient } from '@supabase/auth-helpers-nextjs';
|
||||
|
||||
// with
|
||||
import { createClient } from '@/utils/supabase/server';
|
||||
|
||||
export default async function Page() {
|
||||
// replace
|
||||
const cookieStore = cookies();
|
||||
const supabase = createServerComponentClient<Database>({
|
||||
cookies: () => cookieStore
|
||||
});
|
||||
|
||||
// with
|
||||
const supabase = createClient();
|
||||
|
||||
return...
|
||||
}
|
||||
```
|
||||
|
||||
### 8. Route handlers
|
||||
|
||||
```
|
||||
// replace
|
||||
import { createRouteHandlerClient } from '@supabase/auth-helpers-nextjs';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
// with
|
||||
import { createClient } from '@/utils/supabase/server';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
// replace
|
||||
const supabase = createRouteHandlerClient<Database>({
|
||||
cookies: () => cookieStore,
|
||||
});
|
||||
|
||||
// with
|
||||
const supabase = createClient();
|
||||
|
||||
return...
|
||||
}
|
||||
```
|
||||
|
||||
Likewise, you can replace the clients created with `@supabase/auth-helpers-nextjs` with utility functions you created with `@supabase/ssr`.
|
||||
|
||||
`createMiddlewareClient` → `createServerClient`
|
||||
`createClientComponentClient` → `createBrowserClient`
|
||||
`createServerComponentClient` → `createServerClient`
|
||||
`createRouteHandlerClient` → `createServerClient`
|
||||
|
||||
You can find more clear and concise examples of creating clients in our documentation [here](https://supabase.com/docs/guides/auth/server-side/creating-a-client?queryGroups=framework&framework=nextjs&queryGroups=environment&environment=route-handler#creating-a-client).
|
||||
|
||||
If you have any feedback about this guide, please provide them as a comment below. If you find any issues or have feedback for the `@supabase/ssr` client, please post them as an issue in `@supabase/ssr` repo.
|
||||
|
||||
As always, our GitHub community and Discord channel are open for technical discussions and resolving your issues.
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title = "How to View Database Metrics"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/20938"
|
||||
date_created = "2024-02-01T17:48:11+00:00"
|
||||
topics = [ "database", "platform" ]
|
||||
keywords = [ "metrics", "grafana", "monitoring" ]
|
||||
database_id = "da2d95e5-abc5-47c8-8389-1554d12abf91"
|
||||
---
|
||||
|
||||
To monitor real-time metrics of your database, like CPU, EBS, active database connections, and memory usage, you can deploy a Grafana Dashboard. Check our [GitHub repo](https://github.com/supabase/supabase-grafana) for setup instructions for local or free [Fly.io](http://fly.io/) deployments. Refer to our concise [documentation](https://supabase.com/docs/guides/platform/metrics) to learn more about the metrics endpoint.
|
||||
|
||||
While the [Dashboard's Reports Page](https://supabase.com/dashboard/project/_/reports) displays some metric data, it provides hourly averages, not real-time by the second data. However, it offers query metrics, which the Grafana Dashboard does not include.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title = "I am not receiving password reset emails for Supabase dashboard"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/14043"
|
||||
date_created = "2023-04-30T08:08:07+00:00"
|
||||
topics = [ "auth", "platform" ]
|
||||
keywords = [ "email", "reset" ]
|
||||
database_id = "ec816bde-1a27-461f-89ef-211e96810dd9"
|
||||
---
|
||||
|
||||
Most likely, you signed up on Supabase using a GitHub account. Please try the GitHub login method to see if you can log in. If you still cannot log in, please write to support@supabase.com using your email with a screenshot of the error from the dashboard.
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title = "Importing Stripe or other modules from esm.sh on Deno Edge Functions throws an error"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/14303"
|
||||
date_created = "2023-05-12T01:30:31+00:00"
|
||||
topics = [ "functions" ]
|
||||
keywords = [ "import", "module", "esm" ]
|
||||
database_id = "225cb141-f442-47cf-834d-1d82d703748a"
|
||||
---
|
||||
|
||||
Try adding `?target=deno` to the import path of the module. For Stripe, the updated import would be:
|
||||
|
||||
```
|
||||
import Stripe from "https://esm.sh/stripe@11.2.0?target=deno";
|
||||
```
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
---
|
||||
title = "Increase vector lookup speeds by applying an HSNW index"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21379"
|
||||
date_created = "2024-02-20T05:32:05+00:00"
|
||||
topics = [ "database", "ai", "platform" ]
|
||||
keywords = [ "index", "hnsw", "vector", "performance", "speed" ]
|
||||
database_id = "7d755701-747f-4c3a-b8be-236c5518e4eb"
|
||||
---
|
||||
|
||||
> Although this guide is specifically for HSNW indexes, it can be generalized to work for any index type
|
||||
|
||||
> Building an index without the `CONCURRENTLY` modifier will lock the table, but it will also increase build times. For general advice about indexes, check out this [guide](https://github.com/orgs/supabase/discussions/22449).
|
||||
|
||||
### **To speed up queries, it is ideal to create an HSNW index on your embedded column**
|
||||
|
||||
The general structure for creating an hsnw index follows this pattern:
|
||||
|
||||
```sql
|
||||
CREATE INDEX <custom name of index> ON <table name> USING hnsw (<vectorized column> <search type>);
|
||||
```
|
||||
|
||||
Search can be one of three types:
|
||||
operator | description | search type
|
||||
-- | -- | --
|
||||
`<->` | Euclidean distance | vector_l2_ops
|
||||
`<#>` | negative inner product | vector_ip_ops
|
||||
`<=>` | cosine distance | vector_cosine_ops
|
||||
|
||||
Queries can only utilize the index if it matches the search type used. If you are unsure which search type to prioritize, vector_cosine_ops is the most commonly used. You can checkout our [guide](https://supabase.com/docs/guides/ai/vector-indexes/hnsw-indexes) for more info. The folks at Crunchy Data also wrote an [explainer](https://www.crunchydata.com/blog/hnsw-indexes-with-postgres-and-pgvector) that you may find useful.
|
||||
|
||||
Applying an index can be slow and computationally expensive, so there are a few preparations that should be made beforehand:
|
||||
|
||||
**1. Make sure your pgvector is the latest available version on Supabase.**
|
||||
|
||||
Versions 0.6 and later have accelerated HNSW build speeds. You can observe your current version in the [Dashboard's Extensions Page](https://supabase.com/dashboard/project/_/database/extensions). You can perform a software upgrade in the [Infrastructure Settings ](https://supabase.com/dashboard/project/_/settings/infrastructure)if necessary.
|
||||
|
||||
**2. Setting up an external connection**
|
||||
|
||||
The Dashboard has an internal time limit of ~2 minutes for queries. Indexing a large table will almost always take more time, so it is necessary to execute your code through an external interface, such as PSQL.
|
||||
|
||||
You can install PSQL in [macOS](https://stackoverflow.com/a/49689589/2188186) and [Windows](https://www.postgresql.org/download/windows/) by following these links and instructions.
|
||||
For Linux (Debian) you can run the following:
|
||||
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install postgresql-client
|
||||
```
|
||||
|
||||
Once installed, you can find your PSQL string from the [Database Settings](https://supabase.com/dashboard/project/_/settings/database), which can be executed in the terminal to create a psql session.
|
||||
|
||||
If your network can use IPv6, consider using the direct connection string instead of Supavisor. It's not mandatory, but for tasks that run a long time, it's best to reduce network complexity. To check if your network is compatible, use this cURL command to request your IPv6 address:
|
||||
|
||||
```bash
|
||||
curl -6 https://ifconfig.co/ip
|
||||
```
|
||||
|
||||
If an address is returned, you should be able to use your direct connection string found in the [Database Settings](https://supabase.com/dashboard/project/_/settings/database):
|
||||
|
||||
**3. Increase memory for index creation (optional)**
|
||||
|
||||
The `maintance_work_mem` variable limits the maximum amount of memory that can be used by maintenance operations, such as vacuuming, altering, and indexing tables. In your session you should try to set it to a reasonably high value:
|
||||
|
||||
```sql
|
||||
set maintenance_work_mem to <several Gb's>; -- '#GB'
|
||||
```
|
||||
|
||||
Inspect value to make sure it has been set:
|
||||
|
||||
```sql
|
||||
show maintenance_work_mem;
|
||||
```
|
||||
|
||||
**4. Increase cores for index creation (optional)**
|
||||
|
||||
The `max_parallel_maintenance_workers` variable limits the amount of cores that can be used by maintenance operations, including indexing tables. In your session, you should try to set it to a value roughly 1/2 to 2/3s of your [compute core amount](https://supabase.com/docs/guides/platform/compute-add-ons):
|
||||
|
||||
```sql
|
||||
set max_parallel_maintenance_workers to <integer>;
|
||||
```
|
||||
|
||||
Inspect value to make sure it has been set:
|
||||
|
||||
```sql
|
||||
show max_parallel_maintenance_workers;
|
||||
```
|
||||
|
||||
**5. Setting a custom timeout**
|
||||
|
||||
Disable query timeout for your connection:
|
||||
|
||||
```sql
|
||||
set statement_timeout = '0';
|
||||
```
|
||||
|
||||
Inspect value to make sure it has been set:
|
||||
|
||||
```sql
|
||||
show statement_timeout;
|
||||
```
|
||||
|
||||
**6. Consider temporarily upgrading your compute size (optional)**
|
||||
|
||||
If your task is particularly long, you can speed it up by boosting your computing power temporarily. Compute size is charged by the hour, so you can increase it for an hour or two to finish your task faster, then scale it back afterward. Here is a list of [compute add-ons](https://supabase.com/docs/guides/platform/compute-add-ons). If you want to temporarily upgrade, you can find the add-ons for your project in your [Dashboard's Add-Ons Settings.](https://supabase.green/dashboard/project/_/settings/addons)
|
||||
|
||||
**7. Consider increasing disk size (optional)**
|
||||
|
||||
HSNW indexes can produce temporary files during their construction that may consume a few GBs worth of disk. Consider increasing the disk size in the [Database Settings](https://supabase.com/dashboard/project/_/settings/database) to accommodate for short-term disk stress.
|
||||
|
||||
<img
|
||||
width="947"
|
||||
alt="Screenshot 2024-06-10 at 8 00 28 PM"
|
||||
src="https://github.com/supabase/supabase/assets/91111415/9820e214-8796-4b56-91a3-2e73e4836b2f"
|
||||
/>
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title = "Inserting into Sequence/Serial Table Causes \"duplicate key violates unique constraint\" Error"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21134"
|
||||
date_created = "2024-02-09T03:10:39+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "duplicate", "sequence", "table", "key", "constraint" ]
|
||||
database_id = "a1156bbe-289e-4462-a32d-2b0ca03691e4"
|
||||
|
||||
[[errors]]
|
||||
message = "duplicate key violates unique constraint"
|
||||
---
|
||||
|
||||
If you are receiving the below error for an auto-incremented table:
|
||||
|
||||
> ERROR: duplicate key violates unique constraint
|
||||
|
||||
it likely means that the table's sequence has somehow become out of sync, likely because of a mass import process (or something along those lines).
|
||||
|
||||
Call it a "bug by design", but it seems that you have to manually reset the a primary key index after restoring from a dump file.
|
||||
|
||||
You can run the following commands on your instance to see if your sequence is out-of-sync:
|
||||
|
||||
```sql
|
||||
SELECT MAX(<sequenced_column>) FROM <table_name>;
|
||||
|
||||
SELECT nextval(pg_get_serial_sequence('<public.table_name>', '<sequenced_column_name>'));
|
||||
```
|
||||
|
||||
If the values are off by more than 1, you need to resynchronize your sequence.
|
||||
|
||||
Back up your PG database by restarting in the [General Settings](https://supabase.com/dashboard/project/_/settings/general) (just in case). When you restore your database, you will have a backup saved. Alternatively, you can also just download your properties table instead as a backup.
|
||||
|
||||
Then you can run this:
|
||||
|
||||
```sql
|
||||
SELECT SETVAL('public.<table_name>_<column_nam>_seq', (SELECT MAX(<column_name>) FROM <table_name>)+1);
|
||||
```
|
||||
|
||||
That will set the sequence to the next available value that's higher than any existing primary key in the sequence.
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
---
|
||||
title = "Inspecting edge function environment variables"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/27139"
|
||||
date_created = "2024-06-09T18:44:40+00:00"
|
||||
topics = [ "functions", "cli" ]
|
||||
keywords = [ "logging", "environment", "variables", "secrets", "docker" ]
|
||||
database_id = "f47c9b0e-f537-4908-8d35-5dd3dc4c5627"
|
||||
|
||||
[api]
|
||||
cli = [ "supabase-init", "supabase-secrets-set", "supabase-secrets-list" ]
|
||||
---
|
||||
|
||||
Sometimes it can be informative to log values from your Edge Functions. This walks you through the process of logging environment variables for inspection, but it can be generalized for all logging.
|
||||
|
||||
**Steps:**
|
||||
|
||||
1. enable docker
|
||||
|
||||
2. Create a local Supabase project
|
||||
|
||||
```bash
|
||||
npx supabase init
|
||||
```
|
||||
|
||||
3. create a .env file in the supabase folder
|
||||
|
||||
```bash
|
||||
echo "MY_NAME=Some_name" >> ./supabase/.env
|
||||
```
|
||||
|
||||
4. deploy the newly added secret
|
||||
|
||||
```bash
|
||||
npx supabase secrets set --env-file ./supabase/.env --project-ref <PROJECT REF>
|
||||
```
|
||||
|
||||
5. Run the following CLI command to check secrets:
|
||||
|
||||
```
|
||||
npx supabase secrets list
|
||||
```
|
||||
|
||||
For security reasons, it is not advised to log secrets, but you can log a truncated version just for the reassurance that they're being updated:
|
||||
|
||||
```typescript
|
||||
//logs the function call and the secrets
|
||||
console.log('Hello from Functions!')
|
||||
|
||||
//custom secret
|
||||
console.log('logging custom secret', Deno.env.get('MY_NAME'))
|
||||
|
||||
// default secrets
|
||||
console.log('logging SUPABASE_URL:', Deno.env.get('SUPABASE_URL').slice(0, 15))
|
||||
|
||||
Deno.serve(async (req) => {
|
||||
const { name } = await req.json()
|
||||
const data = {
|
||||
message: `Hello ${name}!`,
|
||||
}
|
||||
|
||||
return new Response(JSON.stringify(data), { headers: { 'Content-Type': 'application/json' } })
|
||||
})
|
||||
```
|
||||
|
||||
After calling your function, you can check your [edge function logs](https://supabase.com/dashboard/project/_/functions/hello-world/logs?s=logging) to observe the logged values. It should look something like this:
|
||||
|
||||
> Note: search filters are case sensitive and must be present in the event message.
|
||||
|
||||

|
||||
|
||||
> Note: excessively long JSON logs may be truncated. If this occurs, use the [JSON.stringify()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) function to convert the JSON object into text. You can then copy and paste the log into a [JSON beautifier.](https://jsonformatter.org/)
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title = "\"insufficient privilege\" when accessing pg_stat_statements"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/20126"
|
||||
date_created = "2024-01-03T10:59:49+00:00"
|
||||
topics = [ "database" ]
|
||||
keywords = [ "privilege", "permissions", "postgres" ]
|
||||
database_id = "1da315be-38ac-487a-b178-f865a1a73c09"
|
||||
|
||||
[[errors]]
|
||||
message = "insufficient privilege"
|
||||
---
|
||||
|
||||
If you see the error "insufficient privilege" when accessing [pg_stat_statements](https://supabase.com/docs/guides/platform/performance#postgres-cumulative-statistics-system) or when accessing [Query Performance Report](https://supabase.com/dashboard/project/_/reports/query-performance), it means that the Postgres role does not have required permissions.
|
||||
|
||||
In this case, you can run the below command to allow the Postgres role to read all statistics from the system:
|
||||
|
||||
```
|
||||
grant pg_read_all_stats to postgres;
|
||||
```
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title = "Interpreting Supabase Grafana CPU charts"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/27022"
|
||||
date_created = "2024-06-05T04:46:27+00:00"
|
||||
topics = [ "platform", "database" ]
|
||||
keywords = [ "cpu", "grafana", "metrics" ]
|
||||
database_id = "ef05da0a-f8bc-44a4-9719-5ae811dba104"
|
||||
---
|
||||
|
||||
> [Guide](https://supabase.com/docs/guides/monitoring-troubleshooting/metrics#deploying-supabase-grafana) for setting up Supabase Grafana
|
||||
|
||||
# CPU
|
||||
|
||||
Here are examples of unhealthy CPU utilization:
|
||||
|
||||

|
||||

|
||||
|
||||
The CPU chart shows 4 distinct metrics of interest:
|
||||
|
||||
- **Yellow**: It represents CPU utilized in [kernel space](https://en.wikipedia.org/wiki/User_space_and_kernel_space) (privileged OS operations). If this is high, it may be a sign that your app is connecting/disconnecting too aggressively. It could also be symptomatic of extension-related errors.
|
||||
- **Blue**: It represents requests in user space and mainly reflects the CPU usage from regular queries. For optimization tips, check out the links at the end of the page.
|
||||
- **Red**: It represents cycles the CPU spent idle because it was waiting on IO tasks. Any amount of red often implies [disk](https://github.com/orgs/supabase/discussions/27003) or, indirectly, [memory](https://github.com/orgs/supabase/discussions/27021) problems. The links outline how to address this type of issue.
|
||||
- **Green**: These are CPU cycles spent idle.
|
||||
|
||||
As the CPU peaks towards 100%, queries and database tasks will begin to throttle, as they won't have enough time or access to the CPU.
|
||||
|
||||
### Other useful Supabase Grafana guides:
|
||||
|
||||
- [Connections](https://github.com/orgs/supabase/discussions/27141)
|
||||
- [Disk](https://github.com/orgs/supabase/discussions/27003)
|
||||
- [Memory](https://github.com/orgs/supabase/discussions/27021)
|
||||
|
||||
### Optimizing:
|
||||
|
||||
1. [Optimize your queries](https://supabase.com/docs/guides/database/query-optimization).
|
||||
2. [Add indexes](https://github.com/orgs/supabase/discussions/22449) if possible.
|
||||
3. [Increasing the compute size](https://supabase.com/docs/guides/platform/compute-add-ons)
|
||||
4. [Distribute load by using read-replicas](https://supabase.com/dashboard/project/_/settings/infrastructure)
|
||||
@@ -0,0 +1,95 @@
|
||||
---
|
||||
title = "Interpreting Supabase Grafana IO charts"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/27003"
|
||||
date_created = "2024-06-04T15:32:14+00:00"
|
||||
topics = [ "database", "platform" ]
|
||||
keywords = [ "io", "disk", "database", "grafana" ]
|
||||
database_id = "0056cd40-df04-4045-bbfb-c245cb15b85d"
|
||||
---
|
||||
|
||||
> [Supabase Grafana Installation Guide](https://supabase.com/docs/guides/platform/metrics#deploying-supabase-grafana)
|
||||
|
||||
There are two primary values that matter for IO:
|
||||
|
||||
- **Disk Throughput**: how much data can be moved to and from disk per second
|
||||
- **IOPS(Input/Output per second)**: how many read/write requests can be performed against your disk per second
|
||||
|
||||
Each compute instance has unique IO settings. The settings at the time this was written are listed below.
|
||||
| Plan | Baseline Disk Throughput | Baseline IOPS |
|
||||
|---------------|--------------------------|---------------|
|
||||
| Nano (free) | 43 Mbps | 250 IOPS |
|
||||
| Micro | 87 Mbps | 500 IOPS |
|
||||
| Small | 174 Mbps | 1,000 IOPS |
|
||||
| Medium | 347 Mbps | 2,000 IOPS |
|
||||
| Large | 630 Mbps | 3,000 IOPS |
|
||||
| XL | 1,048 Mbps | 3,000 IOPS |
|
||||
| 2XL | 1,048 Mbps | 3,000 IOPS |
|
||||
| 4XL | 1,048 Mbps | 3,000 IOPS |
|
||||
| 8XL | 1,048 Mbps | 3,000 IOPS |
|
||||
| 12XL | 1,048 Mbps | 3,000 IOPS |
|
||||
| 16XL | 1,048 Mbps | 3,000 IOPS |
|
||||
|
||||
Compute sizes below XL, to accommodate their limitations, have burst budgets. This is when instances are allowed to utilize 1048 Mbps of disk throughput and 3,000 IOPS for 30 minutes before returning back to their baseline behavior.
|
||||
|
||||
There are other metrics that indicate IO strain.
|
||||
|
||||
This example shows a 16XL database exhibiting severe IO strain:
|
||||
|
||||

|
||||
|
||||
Its Disk IOPS is constantly near peak capacity:
|
||||
|
||||

|
||||
|
||||
Its throughput is also high:
|
||||
|
||||

|
||||
|
||||
As a side-effect, its CPU is encumbered by heavy Busy IOWait activity:
|
||||
|
||||

|
||||
|
||||
Excessive IO usage is highly problematic as it clarifies that your database is expending more IO than it normally is intended to manage. This can be caused by
|
||||
|
||||
- **Excessive and needless sequential scans:** poorly indexed tables force requests to scan disk ([guide to resolve](https://github.com/orgs/supabase/discussions/22449))
|
||||
- **Too little cache**: There is not enough memory, so instead of reading data from the memory cache, it is accessed from disk ([guide to inspect](https://github.com/orgs/supabase/discussions/22449))
|
||||
- **Poorly optimized RLS policies**: RLS that rely heavily on joins are more likely to hit disk. If possible, they should optimized ([RLS best practice guide](https://supabase.com/docs/guides/database/postgres/row-level-security#rls-performance-recommendations))
|
||||
- **Excessive bloat**: This is the least likely to cause major issues, but bloat can take up space, preventing data on disk from being placed in the same locality. This can force the database to scan more pages than necessary. ([explainer guide](https://supabase.com/blog/postgres-bloat))
|
||||
- **Uploading high amounts of data:** temporarily increase compute add-on size for the duration of the uploads
|
||||
- **Insufficient memory**: Sometimes an inadequate amount of memory forces queries to hit disk instead of the memory cache. Address memory issues ([guide](https://github.com/orgs/supabase/discussions/27021)) can reduce disk strain.
|
||||
|
||||
If a database exhibited some of these metrics for prolonged periods, then there are a few primary approaches:
|
||||
|
||||
- Scale the database to get more IO if possible
|
||||
- Optimize queries/tables or refactor database/app to reduce IO
|
||||
- Spin-up a [read-replica](https://supabase.com/dashboard/project/_/settings/infrastructure)
|
||||
- Modify IO configs in the [Database Settings](https://supabase.com/dashboard/project/_/settings/database)
|
||||
- [Partitions](https://supabase.com/docs/guides/database/partitions): Generally should be used on very large tables to minimize data pulled from disk
|
||||
|
||||
Other useful Supabase Grafana guides:
|
||||
|
||||
- [Connections](https://github.com/orgs/supabase/discussions/27141)
|
||||
- [Memory](https://github.com/orgs/supabase/discussions/27021)
|
||||
- [CPU](https://github.com/orgs/supabase/discussions/27022)
|
||||
|
||||
### Esoteric factors
|
||||
|
||||
**Webhooks**:
|
||||
Supabase webhooks use the pg_net extension to handle requests. The `net.http_request_queue` table isn't indexed to keep write costs low. However, if you upload millions of rows to a webhook-enabled table too quickly, it can significantly increase the read costs for the extension.
|
||||
|
||||
To check if reads are becoming expensive, run:
|
||||
|
||||
```sql
|
||||
select count(*) as exact_count from net.http_request_queue;
|
||||
-- the number should be relatively low <20,000
|
||||
```
|
||||
|
||||
If you encounter this issue, you can either:
|
||||
|
||||
1. Increase your compute size to help handle the large volume of requests.
|
||||
|
||||
2. Truncate the table to clear the queue:
|
||||
|
||||
```sql
|
||||
TRUNCATE net.http_request_queue;
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title = "\"JWT Expired\" Error in Supabase Dashboard"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21135"
|
||||
date_created = "2024-02-09T04:03:23+00:00"
|
||||
topics = [ "studio" ]
|
||||
keywords = [ "JWT" ]
|
||||
database_id = "362840be-a99c-4a98-bf4b-6e44a399af12"
|
||||
|
||||
[[errors]]
|
||||
message = "JWT expired"
|
||||
---
|
||||
|
||||
When the Dashboard issues JWT expired errors, it usually means your computer's time is not in sync with the actual time.
|
||||
|
||||
Go to https://time.is/ to compare your computer's clock with your local time. If your computer's time is inaccurate, sync it to resolve the issue
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title = "Lost access/Forgot the MFA device"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/23183"
|
||||
date_created = "2024-04-23T12:52:13+00:00"
|
||||
topics = [ "auth", "platform" ]
|
||||
keywords = [ "mfa", "security" ]
|
||||
database_id = "60bd4a35-fc2e-4e42-bcf6-a430d380c930"
|
||||
---
|
||||
|
||||
**Non-SSO User**
|
||||
|
||||
For now, we [will not be able to restore access to your account](https://supabase.com/docs/guides/platform/multi-factor-authentication#enable-mfa) if you lose all your two-factor authentication credentials. Register a backup factor if necessary.
|
||||
|
||||
If you forgot the MFA authentication method used, you can reach out to [our support](https://supabase.com/dashboard/support/new).
|
||||
|
||||
**SSO User**
|
||||
|
||||
Reach out to [our support](https://supabase.com/dashboard/support/new) and we will assist you further.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
title = "Memory and Swap usage explained"
|
||||
github_url = "https://github.com/orgs/supabase/discussions/21460"
|
||||
date_created = "2024-02-22T19:01:27+00:00"
|
||||
topics = [ "database", "platform" ]
|
||||
keywords = [ "memory", "swap", "ram", "disk", "IO" ]
|
||||
database_id = "43b62743-252c-4069-a719-0c0737839fd9"
|
||||
---
|
||||
|
||||
## Understanding swap and memory usage
|
||||
|
||||
- Swap is part of Linux's tiered memory system
|
||||
- Serves as a backup memory space when RAM is limited.
|
||||
- System prioritizes keeping actively used data in RAM
|
||||
- Data is temporarily cached in memory for quick access
|
||||
- Swap is used for less frequently accessed or non-critical data
|
||||
- Default swapiness value of 60 indicates the system's preference to fill up swap for performance benefits
|
||||
|
||||
## Compute instance configuration
|
||||
|
||||
- Default swapiness: 60 (out of 100)
|
||||
- Determines how aggressively the system moves data from RAM to swap
|
||||
- Default value in Linux distributions
|
||||
- Changing the swapiness value significantly impacts system behavior, as it is a non-linear value. A small adjustment of 10 can result in a very different system behavior
|
||||
- Swap provision: 1024MB on every compute instance
|
||||
|
||||
## Issues with high swap usage
|
||||
|
||||
- When swap reaches its limits, the system faces decisions:
|
||||
1. Evict cached memory from swap, which affects disk performance
|
||||
2. Evict cached memory from the system's memory cache, leading to increased disk accesses
|
||||
3. Access the disk directly without caching, resulting in more frequent disk reads
|
||||
- Swap usage reaching limits indicates running out of free memory
|
||||
|
||||
## Disk balance and AWS limits
|
||||
|
||||
- Each project has a baseline 'balance replenishment rate'
|
||||
- The replenishment rate is higher on greater AWS instances
|
||||
- Disk IO usage below replenishment rate keeps balance at 99%
|
||||
- Disk IO usage above replenishment rate decreases balance
|
||||
- Balance increases when IO usage is below replenishment rate
|
||||
- AWS does not export relevant metrics for tracking IO usage
|
||||
|
||||
## Monitoring recommendations
|
||||
|
||||
- Monitor memory usage:
|
||||
- If usage is over 85% and swap usage is over 90% for an extended period, optimize database access or add more resources
|
||||
- Monitor CPU iowait usage and disk IO metrics:
|
||||
- Exported metrics here: **https://github.com/supabase/grafana-agent-fly-example/blob/main/metrics.md**
|
||||
- Key metrics to track excessive disk IO usage include:
|
||||
- `node_disk_reads_completed_total`: Tracks the total number of completed disk reads.
|
||||
- `node_disk_io_time_seconds_total`: Measures the total time spent on disk IO operations.
|
||||
- `node_disk_io_now`: Indicates the current disk IO operations.
|
||||
- Differentiate system and data disks using the 'device' label
|
||||
- System disk: `{device="nvme0n1"}` (contains swap)
|
||||
- Data disk: `{device="nvme1n1"}` (dedicated to Postgres data)
|
||||
@@ -14,6 +14,7 @@ This guide explains how connections impact your Supabase database's performance
|
||||
Supabase has an [open-source Grafana Repo](https://github.com/supabase/supabase-grafana) that displays real-time metrics of your database. Although the [Reports Dashboard ](/dashboard/project/_/reports) provides similar metrics, it averages the data by the hour or day. Having visuals of your connection usage can help you better allocate resources.
|
||||
|
||||
_Visual of Grafana Dashboard_
|
||||
|
||||

|
||||
|
||||
It can be run locally within Docker. Alternatively, you can deploy it to fly.io or Grafana Cloud, which are better for long-term data collection.
|
||||
@@ -23,6 +24,7 @@ Installation instructions can be found in it the [metrics docs ](/docs/guides/pl
|
||||
## Observing connections
|
||||
|
||||
In Supabase Grafana, the "Client Connections" graph shows connections to both Supavisor and Postgres
|
||||
|
||||

|
||||
|
||||
- **Yellow**: The yellow line represents the number of actively querying and idle connections to the Supavisor Pooler.
|
||||
@@ -81,6 +83,7 @@ If you believe a connection should be killed, you can do so by running the follo
|
||||
The Supavisor Pooler is an intermediary between your clients (application servers) and the database. In transaction mode (port 6543), it can enable Postgres to share single connections with many clients, only allowing access when a query is pending. This prevents idle clients from hogging a direct connection and allows for more throughput.
|
||||
|
||||
In cases where you see significantly more pooler connections than direct connections, if you can, you should consider increasing how many direct connections the pooler is allowed to manage in the [Dashboard's Database Settings](/dashboard/project/_/settings/database):
|
||||
|
||||
.
|
||||
|
||||
The general rule is that if you are using the PostgREST database API, you should avoid raising your pool size past 40%. Otherwise, you can commit 80% to the pool. This leaves adequate room for the Authentication server and other utilities.
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title = "NEW variable is null in a trigger function."
|
||||
github_url = "https://github.com/orgs/supabase/discussions/15934"
|
||||
date_created = "2023-07-20T19:05:52+00:00"
|
||||
topics = [ "database", "functions" ]
|
||||
keywords = [ "trigger", "function", "statement", "row", "NEW", "OLD", "SQL" ]
|
||||
database_id = "f5cabb97-aae3-4fb5-b597-4e7857821753"
|
||||
---
|
||||
|
||||
When you create a function and call it from a trigger the NEW variable is only passed in if the trigger is on ROW operations
|
||||
|
||||
The UI currently defaults to STATEMENT which will not provide NEW or OLD variables to the function.
|
||||
|
||||

|
||||
|
||||
Also in SQL (reference: https://www.postgresql.org/docs/current/sql-createtrigger.html)
|
||||
|
||||

|
||||
+21
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title = "Next.js 13/14 stale data when changing RLS or table data."
|
||||
github_url = "https://github.com/orgs/supabase/discussions/19084"
|
||||
date_created = "2023-11-19T19:33:06+00:00"
|
||||
topics = [ "auth", "platform" ]
|
||||
keywords = [ "cache", "rls", "next.js" ]
|
||||
database_id = "9be3727b-c3ea-4dda-b30c-55f3c8aa8f35"
|
||||
---
|
||||
|
||||
Next.js caches urls in certain cases. This is causing users to lose lots of time debugging early on with RLS changes. Changing the table data in the UI will also not be returned in these cases.
|
||||
|
||||
You can look at the Dashboard API Edge log to see if the request is making it to Supabase.
|
||||
Another way to check if the url caching is impacting you is to change `.select('*')` to `.select('colname')` or change column names. This would bust the next.js cache.
|
||||
|
||||
Users have suggested the following three options to turn off the caching, but please refer to next.js docs as needed.
|
||||
|
||||
`export const dynamic = 'force-dynamic'; // no caching`
|
||||
or
|
||||
`export const fetchCache = 'force-no-store' // to page.js`
|
||||
or
|
||||
`export const revalidate = 0 `
|
||||
Loaded 100 of 885 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user