Giter VIP home page Giter VIP logo

supabase-on-aws's Introduction

Supabase on AWS - CloudFormation/CDK Template

Launch in minutes. Scale to millions.

This repo includes a template of starting Supabase stack on AWS via CloudFormation/CDK. This template use managed services such as Amazon ECS and Amazon Aurora etc...

Architecture

architecture-diagram

smart-cdn-caching

Deploy via CloudFormation template

Region View Stable Latest
US East (N. Virginia) View launch launch
US West (Oregon) View launch launch
Europe (Ireland) View launch launch
Asia Pacific (Tokyo) View launch launch
Asia Pacific (Osaka) View launch launch
Asia Pacific (Singapore) View launch launch
Asia Pacific (Sydney) View launch launch
Asia Pacific (Mumbai) View launch launch

Optional templates

Template Link
AWS WAF (Web ACL) launch

Specification and Limitation

  • APIs
    • All containers run on ECS Fargate (Graviton2).
    • All components are configured with AutoScaling.
    • GraphQL is not supported, because pg_graphql is not supported with Amazon RDS/Aurora.
  • Service Discovery
    • Each component is discovered as ***.supabase.internal.
  • Database (PostgreSQL)
  • Supabase Studio
    • It is deployed on Amplify Hosting.
    • Todo: Add option to deploy the studio in different regions.
    • ⚠️ Warning: Supabase Studio is open to web and can be accessed by malicious actors. We strongly suggest you active 'Access control' globaly and setup a strong password and username.

Fargate Task Size

Size vCPU Memory
micro 256 512
small 512 1024
medium 1024 2048
large 2048 4096
xlarge 4096 8192
2xlarge 8192 16384
4xlarge 16384 32768

IAM Policy to create CloudFormation Stack

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "CloudFormation",
            "Effect": "Allow",
            "Action": "cloudformation:*",
            "Resource": "*"
        },
        {
            "Sid": "supabase",
            "Effect": "Allow",
            "Action": [
                "application-autoscaling:*",
                "ec2:*",
                "ecs:*",
                "elasticloadbalancing:*",
                "events:*",
                "iam:*",
                "lambda:*",
                "logs:*",
                "s3:*",
                "secretsmanager:*",
                "servicediscovery:*",
                "ses:*",
                "ssm:*",
                "states:*",
                "rds:*",
                "route53:*"
            ],
            "Resource": "*"
        },
        {
            "Sid": "supabaseCDN",
            "Effect": "Allow",
            "Action": [
                "cloudfront:*",
                "wafv2:Get*",
                "wafv2:List*"
            ],
            "Resource": "*"
        },
        {
            "Sid": "cacheManager",
            "Effect": "Allow",
            "Action": [
                "apigateway:*",
                "lambda:*",
                "logs:*",
                "sqs:*"
            ],
            "Resource": "*"
        },
        {
            "Sid": "supabaseStudio",
            "Effect": "Allow",
            "Action": [
                "amplify:*",
                "codecommit:*",
                "lambda:*",
                "logs:*",
                "sns:*"
            ],
            "Resource": "*"
        }
    ]
}

Deploy via CDK

This cdk project has many resources for CloudFormation. It is highly recomended to remove these resources for CloudFormation to use it as CDK.

git clone https://github.com/mats16/supabase-on-aws.git

cd supabase-on-aws

yarn install

cdk deploy Supabase

supabase-on-aws's People

Contributors

johnyoat avatar mats16 avatar mattrigg9 avatar umuthopeyildirim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

supabase-on-aws's Issues

How to lock down studio?

Improve documentation

Link

Add a link to the page which needs improvement (if relevant)

Describe the problem

By default, studio launched unauthed and exposed to the open web, how can I configure github sso?

Describe the improvement

A clear and concise description of the improvement.

Additional context

Add any other context or screenshots that help clarify your question.

Supabase Studio Build Failed on AWS Amplify

Bug report

Describe the bug

I've used the cloudformation template provided in this repository, while it seems like everything has built correctly, Amplify's build failed.

The only culprit I could find was npm ERR! engine Not compatible with your version of node/npm: [email protected]

I have attached the logs below:

2024-04-18T19:08:38.928Z [INFO]: # Switching to commit: 7fbe48af55fb8425e09bf8ddfd070fc4193ed690
2024-04-18T19:08:39.586Z [INFO]: Note: switching to '7fbe48af55fb8425e09bf8ddfd070fc4193ed690'.
                                 You are in 'detached HEAD' state. You can look around, make experimental
                                 changes and commit them, and you can discard any commits you make in this
                                 state without impacting any branches by switching back to a branch.
                                 If you want to create a new branch to retain commits you create, you may
                                 do so (now or later) by using -c with the switch command. Example:
                                 git switch -c <new-branch-name>
                                 Or undo this operation with:
                                 git switch -
                                 Turn off this advice by setting config variable advice.detachedHead to false
                                 HEAD is now at 7fbe48af5 fix: Fix the loading state on the Continue with Github button (#17959)
2024-04-18T19:08:39.615Z [INFO]: Successfully cleaned up Git credentials
2024-04-18T19:08:39.616Z [INFO]: # Checking for Git submodules at: /codebuild/output/src2506527748/src/Supabase/.gitmodules
2024-04-18T19:08:39.636Z [INFO]: # Retrieving environment cache...
2024-04-18T19:08:39.674Z [WARNING]: ! Unable to write cache: {"code":"ERR_BAD_REQUEST","message":"Request failed with status code 404"})}
2024-04-18T19:08:39.674Z [INFO]: ---- Setting Up SSM Secrets ----
2024-04-18T19:08:39.674Z [INFO]: SSM params {"Path":"/amplify/d3lccq20xvefbh/main/","WithDecryption":true}
2024-04-18T19:08:39.729Z [WARNING]: !Failed to set up process.env.secrets
2024-04-18T19:08:39.730Z [INFO]: No live updates for this build run
2024-04-18T19:08:39.734Z [INFO]: # Retrieving cache...
2024-04-18T19:08:39.765Z [INFO]: # Retrieved cache
2024-04-18T19:08:39.803Z [INFO]: # Starting phase: preBuild
                                 # Executing command: echo POSTGRES_PASSWORD=$(aws secretsmanager get-secret-value --secret-id $DB_SECRET_ARN --query SecretString | jq -r . | jq -r .password) >> .env.production
2024-04-18T19:08:40.374Z [INFO]: # Executing command: echo SUPABASE_ANON_KEY=$(aws ssm get-parameter --region $SUPABASE_REGION --name $ANON_KEY_NAME --query Parameter.Value) >> .env.production
2024-04-18T19:08:40.966Z [INFO]: # Executing command: echo SUPABASE_SERVICE_KEY=$(aws ssm get-parameter --region $SUPABASE_REGION --name $SERVICE_KEY_NAME --query Parameter.Value) >> .env.production
2024-04-18T19:08:41.559Z [INFO]: # Executing command: env | grep -e STUDIO_PG_META_URL >> .env.production
2024-04-18T19:08:41.561Z [INFO]: # Executing command: env | grep -e SUPABASE_ >> .env.production
2024-04-18T19:08:41.562Z [INFO]: # Executing command: env | grep -e NEXT_PUBLIC_ >> .env.production
2024-04-18T19:08:41.563Z [INFO]: # Executing command: cd ../
2024-04-18T19:08:41.564Z [INFO]: # Executing command: npx [email protected] prune --scope=studio
2024-04-18T19:08:42.271Z [WARNING]: npm
2024-04-18T19:08:42.280Z [WARNING]: WARN exec The following package was not found and will be installed: [email protected]
2024-04-18T19:08:45.584Z [INFO]: Generating pruned monorepo for studio in /codebuild/output/src2506527748/src/Supabase/out
2024-04-18T19:08:45.590Z [INFO]: - Added common
                                 - Added config
                                 - Added shared-data
2024-04-18T19:08:45.651Z [INFO]: - Added studio
2024-04-18T19:08:45.651Z [INFO]: - Added tsconfig
2024-04-18T19:08:45.683Z [INFO]: - Added ui
2024-04-18T19:08:45.757Z [INFO]: # Executing command: npm clean-install
2024-04-18T19:08:49.567Z [WARNING]: npm
2024-04-18T19:08:49.573Z [WARNING]: ERR! code EBADENGINE
                                    npm ERR! engine Unsupported engine
                                    npm ERR! engine Not compatible with your version of node/npm: [email protected]
                                    npm ERR! notsup Not compatible with your version of node/npm: [email protected]
                                    npm ERR! notsup Required: {"npm":">=9.0.0 <10.0.0","node":">=18.0.0 <19.0.0"}
                                    npm ERR! notsup Actual:   {"npm":"10.5.0","node":"v18.20.0"}
                                    npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-18T19_08_45_978Z-debug-0.log
2024-04-18T19:08:49.682Z [ERROR]: !!! Build failed
2024-04-18T19:08:49.682Z [INFO]: Please read more about Amplify Hosting's support for SSR frameworks to find if your build failure is related to an unsupported feature: https://docs.aws.amazon.com/amplify/latest/userguide/amplify-ssr-framework-support.html. You may also find this troubleshooting guide useful: https://docs.aws.amazon.com/amplify/latest/userguide/troubleshooting-ssr-deployment.html
2024-04-18T19:08:49.682Z [ERROR]: !!! Error: Command failed with exit code 1
2024-04-18T19:08:49.682Z [INFO]: # Starting environment caching...
2024-04-18T19:08:49.682Z [INFO]: # Environment caching completed
Terminating logging...

Is there a way I could separately set up the Supabase Studio in EC2?

Connecting to Studio

Noobie here. I just spun up a fresh Supabase stack on AWS. How do I connect to Studio? I notice it creates a loadbalancer on AWS so I pointed a CNAME record to it but didn't get any response. Any pointers appreciated. Cheers, Dave

CreateRepository request is not allowed because there is no existing repository in this AWS account or AWS Organization

Good Day,

Attempting to deploy Superbase on AWS using the launch templates but getting the below error:
CreateRepository request is not allowed because there is no existing repository in this AWS account or AWS Organization (Service: AWSCodeCommit; Status Code: 400

AWS has deprecated AWS CodeCommit and this might be the reason for the error.

Could you kindly assist in finding a new solution and updating the cloudformation stack.

Launch Stack doesn't create "working" stack

Bug report

Describe the bug

I believe this is something relating to the "NamespaceName" parameter that makes all the services link up using an internal dns name. Without any further documentation inside this repository I'm unsure whether this is the case.

Once the stack is finished launching, when accessing the project from inside Supabase Studio it gets stuck "Connecting to project"

When checking the network tab from chrome dev tools, a number of errors are indicated - 404, 503 (see screenshots)

For the 503 error, when manually accessing the url with the api key specified as a url parameter it returns a JSON response
{"message":"no Route matched with those values"}

To Reproduce

  1. Open the README.md
  2. Click on "Launch Stack"
    • I have tried both "Stable" & "Latest" for "N. Virginia" & "Ireland"
  3. Scroll down to the bottom on the CloudFormation Stack create page
  4. Check the "Acknowledge" boxes
  5. Click "Create Stack"

Expected behavior

A fully functioning stack of the supabase system to be launched and usable / accessible.

Screenshots

Screen Shot 2022-12-25 at 21 43 16

Screen Shot 2022-12-25 at 21 43 29

Screen Shot 2022-12-25 at 21 44 39

Additional context

To my understanding, this repository is essentially providing a 1-click setup to get Supabase running on AWS. Incase the specific urls for my deployment are helpful, I have listed them below.

Amplify Studio URL: https://main.d2utrizos6o5a4.amplifyapp.com/
CloudFront URL: https://d1j57i0k9sfize.cloudfront.net/

Kong Authentication Request 401

Bug report

Describe the bug

On Friday, we had a working deployment of:

  • public.ecr.aws/u3p7q2r8/kong:latest
  • public.ecr.aws/supabase/gotrue:v2.69.2
  • public.ecr.aws/supabase/postgrest:v11.1.0

Today, we get:

POST /auth/v1/token?grant_type=password HTTP/1.1" 401 in the Kong service

To Reproduce

We have deployed this in a terraform script. So we will likely need to stay high level in this issue.

Question

It seems like public.ecr.aws/u3p7q2r8/kong:latest is overwritten on publish. Did anything change that would make this incompatible with older versions of auth?

Is there perhaps any way to publish those old tags so we can stabilize the kong service?

Excessive CloudWatch Usage

Bug report

Describe the bug

I wanted to bring to your attention an issue I have encountered with CloudWatch costs after starting supabase-on-aws. I believe the costs have become excessive, averaging more than $2.50 per day over the span of two months.

To Reproduce

Just use this repo.

Expected behavior

The exact cause of this increase is currently unknown to me. I wanted to reach out to other users to confirm if they have experienced similar cost spikes.

Screenshots

Screenshot 2023-07-11 at 1 28 51 AM
costs.csv

Support pg_net

Feature request

Is your feature request related to a problem? Please describe.

supabase/db uses pg_net for Webhooks functionality.

But pg_net is not supported in Amazon RDS/Aurora.

Describe the solution you'd like

pg_net runs on RDS.

Describe alternatives you've considered

N/A

Additional context

N/A

Storage functionality missing

Bug report

Describe the bug

When Studio is opened, the "Storage" section on the dashboard is missing.
When trying to access the storage page using the direct url (as taken from local running copy) - it redirect straight back to the dashboard, temporarily displaying "Buckets" in the tab title.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Launch the stack
  2. Open studio url
  3. Storage is missing from side navigation

Expected behavior

See storage tab which gives abilities to "Create Buckets"

Screenshots

Missing tab on CloudFormation stack
Screen Shot 2022-12-27 at 15 38 30

Present on docker-compose local install
Screen Shot 2022-12-27 at 15 38 59

Storage Service Running in ECS Cluster
Screen Shot 2022-12-27 at 15 41 07
Screen Shot 2022-12-27 at 15 41 00

FATAL: password authentication failed for user "supabase_admin"

Bug report

Describe the bug

Fresh Cloud Formation deployment - ECS some tasks fail with FATAL: password authentication failed for user "supabase_admin"

To Reproduce

Fresh deployment

Steps to reproduce the behaviour, please provide code snippets or a repository:

  1. Fresh deploy to AWS - eu-west-1

Expected behaviour

..

Screenshots

image

image

System information

....

Additional context

Realtime Not Working

The default realtime deployment isn't working. All other services are working fine, except realtime where I'm getting errors like the following:

Screenshot 2024-05-05 at 2 27 06 PM

Do I have to do any extra configuration for realtime? Would love to have a fix here asap.

Support clustering of realtime v2

Feature request

Is your feature request related to a problem? Please describe.

To use the clustering feature, the application must be able to recognize its own ip address.
https://github.com/supabase/realtime/blob/main/rel/env.sh.eex

This is difficult if you are using AWS Fargate.

Describe the solution you'd like

Recognize the IP of the AWS Fargate instance somehow from in the container.

Describe alternatives you've considered

N/A

Additional context

N/A

Support Opentelemetry Tracing

Opentelemetry support status

  • Kong
  • GoTrue
  • PostgREST
  • Supabase Realtime
  • Supabase Storage
  • Supabase PostgresMeta

Amazon X-Ray

AWS X-Ray does not support random trace_id now.
It is needed to send tracing data with opentelemetry without id_generator.

Template for ap-south-1 region

Feature request

Is your feature request related to a problem? Please describe.

Create template to use for ap-south-1 (Mumbai) Region

Describe the solution you'd like

Add ap-south-1 (Mumbai) as one of Region to launch stack

Screenshot

ROLLBACK_COMPLETE

What am i doing wrong?
image

2024-07-17 17:20:36 UTC+0200 Supabase ROLLBACK_IN_PROGRESS - The following resource(s) failed to create: [ClusterDefaultServiceDiscoveryNamespaceC336F9B4, LoadBalancerBE9EEC3A, StudioRepositoryImportFunctionF87C7D62, VPCPublicSubnet1NATGatewayE0556630, CloudFrontPrefixList22014EFD, StorageServiceSecurityGroupF6280DC0, JwtSecretJsonWebTokenFunctionF8BA9D2A, JwtSecretGenerateTokenProviderframeworkonEventServiceRoleDefaultPolicy14F466A4, CdnCacheManagerApiFunction8F3CC846, SmtpUser4973DF55, DatabaseCluster5B53A178]. Rollback requested by user.
2024-07-17 17:20:36 UTC+0200 CdnCacheManagerApiFunction8F3CC846 CREATE_FAILED - Resource creation cancelled
2024-07-17 17:20:33 UTC+0200 JwtSecretGenerateTokenProviderframeworkonEventServiceRoleDefaultPolicy14F466A4 CREATE_FAILED - Internal Failure
2024-07-17 17:20:32 UTC+0200 StorageServiceSecurityGroupF6280DC0 CREATE_FAILED - Resource creation cancelled
2024-07-17 17:20:32 UTC+0200 VPCPublicSubnet1NATGatewayE0556630 CREATE_FAILED - Resource creation cancelled
2024-07-17 17:20:32 UTC+0200 LoadBalancerBE9EEC3A CREATE_FAILED - Resource creation cancelled
2024-07-17 17:20:32 UTC+0200 SmtpUser4973DF55 CREATE_FAILED - Resource creation cancelled
2024-07-17 17:20:32 UTC+0200 JwtSecretJsonWebTokenFunctionF8BA9D2A CREATE_FAILED - Resource creation cancelled
2024-07-17 17:20:32 UTC+0200 DatabaseCluster5B53A178 CREATE_FAILED - Resource creation cancelled
2024-07-17 17:20:32 UTC+0200 ClusterDefaultServiceDiscoveryNamespaceC336F9B4 CREATE_FAILED - Resource creation cancelled
2024-07-17 17:20:32 UTC+0200 CloudFrontPrefixList22014EFD CREATE_FAILED - Resource creation cancelled
2024-07-17 17:20:32 UTC+0200 JwtSecretJsonWebTokenFunctionF8BA9D2A CREATE_IN_PROGRESS CONFIGURATION_COMPLETE Eventual consistency check initiated
2024-07-17 17:20:32 UTC+0200 StudioRepositoryImportFunctionF87C7D62 CREATE_FAILED - Resource handler returned message: "'MemorySize' value failed to satisfy constraint: Member must have value less than or equal to 3008 (Service: Lambda, Status Code: 400, Request ID: 7298f13b-8f54-4e32-87aa-79764dd300e3)" (RequestToken: 505110d5-e1a7-7c1b-c6b3-e0325d3098a6, HandlerErrorCode: InvalidRequest)

`cdk deploy Supabase` fails

Bug report

First of all, thanks for fixing the git issue in the Repository import.

When I try to deploy this stack after cloning it, it still fails due to one of two reasons.

Describe the bug

  1. Sometimes, the RepoImportJob exceeds the timelimit and I get:
12:46:52 PM | CREATE_FAILED        | Custom::RepoImportJob                         | Studio/Repo/main/Default
Received response status [FAILED] from custom resource. Message returned: Error: 2023-03-30T10:46:42.596Z 502e30ef-ab43-4586-be80-dc3fb00eb348 Task timed out afte
r 180.00 seconds

Logs: /aws/lambda/Supabase-StudioRepoImportFunctionDEF0C9F1-gLGfGN4WUBfy

at invokeUserFunction (/var/task/framework.js:2:6)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async onEvent (/var/task/framework.js:1:365)
at async Runtime.handler (/var/task/cfn-response.js:1:1543) (RequestId: 6ee1ee56-3131-4f79-b55d-b179a39a52ea)
  1. Other times (I think if I increase the timeout of the RepoImportJob to 5min instead of 3min), I get the following issue with the Auth/Fargate/Service resource (also see screenshot):
Resource handler returned message: "Error occurred during operation 'ECS Deployment Circuit Breaker was triggered'." (RequestToken: xxx-xxx-xxx-xxx, HandlerErrorCode: GeneralServiceException)

In the ECS view in the AWS console, it just tells me that the service is unhealthy.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Clone the repository
  2. Run cdk deploy Supabase (after signing in with the CLI)
  3. It will successfully create almost all the resources but then fails as mentioned above

Expected behavior

The stack should be successfully created

Screenshots

image

System information

  • OS: macOS
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

Support langchain-embedding_search

Feature request

Is your feature request related to a problem? Please describe.

langchain-embedding_search is not supported for RDS/Aurora.

Describe the solution you'd like

Install langchain-embedding_search to RDS/Aurora.

Describe alternatives you've considered

N/A

Additional context

N/A

Realtime Postgres updates unreliable / not working

Bug report

Realtime is unable to broadcast most Postgres changes. It sometimes works, but is really unreliable. All other realtime events, for e. g. presence states or cursor positions work as expected.

To Reproduce

Simply deploy the stack on AWS, in my case I deployed it in eu-west-1 region. I chose micro Fargate task size.

Expected behavior

Listening to Postgres changes should work just like in the hosted version.

Screenshots

Maybe this has something to do with realtime not being able to correctly connect to the RDS database? These logs are shown in the realtime logs when trying to watch Postgres changes:

Bildschirmfoto 2024-03-19 um 18 11 23

Deployment fails with error: Resource handler returned message: "'MemorySize' value failed to satisfy constraint: Member must have value less than or equal to 3008 (Service: Lambda, Status Code: 400

Bug report

Describe the bug

Deployment fails with error: Resource handler returned message: "'MemorySize' value failed to satisfy constraint: Member must have value less than or equal to 3008 (Service: Lambda, Status Code: 400

Supabase: creating CloudFormation changeset...
9:23:28 AM | CREATE_FAILED        | AWS::Lambda::Function                         | StudioRepositoryImportFunctionF87C7D62
Resource handler returned message: "'MemorySize' value failed to satisfy constraint: Member must have value less than or equal to 3008 (Service: Lambda, Status Code: 400, Request ID: 419ca9ff-069e-4915-83d3-fdbecfbf06ad)" (RequestToken: 5b39077e-76e
3-3c3d-714e-7ead45d97aff, HandlerErrorCode: InvalidRequest)

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

git clone https://github.com/mats16/supabase-on-aws.git
cd supabase-on-aws
yarn install
cdk bootstrap
cdk deploy Supabase

Expected behavior

Succesful supabase installation.

Screenshots

Screenshot 2023-11-22 at 09 27 19

System information

  • OS: macOS 14.1
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Seems that error in this line. If I specify 3008 the deployment works.

Urgent: Kong service always returning "Invalid authentication credentials" with latest image

Bug report

Describe the bug

The latest image of public.ecr.aws/u3p7q2r8/kong:latest returns a 401 Invalid authentication credentials for every request.

I looked through the commit history and noticed this change in template syntax when passing the secrets. Could this be related?

This has taken down our production stack and there is no other ECR image to roll back to, please help.

To Reproduce

Launch the latest Kong image from ECR and attempt to make any request (GraphQL, REST, etc)

Expected behavior

Requests should succeed - the client code has not changed.

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

Connecting to RDS

Hello,

This is more of a question rather than an issue so close if not allowed.

I could not find any documentation on how to specifically connect to the RDS instance. I have read in #72 that the RDS instance is not exposed to the internet so my question is how would I connect to the database using an ORM or database client like pgAdmin?

Thankyou

bug : Update from supabase studio version v0.23.09 to v0.23.11.

Bug report

I confirm this is a bug with Supabase, not with my own application.
I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
While attempting to update the studioBranch to the latest version, I encountered an error. It appears that the directory structure in Supabase has changed between versions v0.23.09 and v0.23.11, particularly the path from /studio to /apps/studio. This change seems to affect the build process, causing it to fail.

To Reproduce
Steps to reproduce the behavior:

BUG : Update from supabase studio version v0.23.09 to v0.23.11.
Observe the directory change from /studio to /apps/studio.
Attempt to build using the current configuration.
Notice the build process fails due to the directory change.
Expected behavior
The build process should adapt to the updated directory structure without causing any errors, or the documentation should provide clear instructions on how to handle such changes in directory paths.

Screenshots
If applicable, add screenshots to help explain your problem.

/** BuildSpec for Amplify Hosting */
const buildSpec = BuildSpec.fromObjectToYaml({
    version: 1,
    applications: [{
    appRoot,  // TODO: studio => apps/studio ??
    frontend: {
        phases: {
        preBuild: {
            commands: [
            'echo POSTGRES_PASSWORD=$(aws secretsmanager get-secret-value --secret-id $DB_SECRET_ARN --query SecretString | jq -r . | jq -r .password) >> .env.production',
            'echo SUPABASE_ANON_KEY=$(aws ssm get-parameter --region $SUPABASE_REGION --name $ANON_KEY_NAME --query Parameter.Value) >> .env.production',
            'echo SUPABASE_SERVICE_KEY=$(aws ssm get-parameter --region $SUPABASE_REGION --name $SERVICE_KEY_NAME --query Parameter.Value) >> .env.production',
            'env | grep -e STUDIO_PG_META_URL >> .env.production',
            'env | grep -e SUPABASE_ >> .env.production',
            'env | grep -e NEXT_PUBLIC_ >> .env.production',
            'cd ../',
            'npx [email protected] prune --scope=studio',
            'npm clean-install',
            ],
        },
        build: {
            commands: [
            'npx turbo run build --scope=studio --include-dependencies --no-deps',
            'npm prune --omit=dev',
            ],
        },
        postBuild: {
            commands: [
            `cd ${appRoot}`,
            `rsync -av --ignore-existing .next/standalone/${repository.repositoryName}/${appRoot}/ .next/standalone/`,
            `rsync -av --ignore-existing .next/standalone/${repository.repositoryName}/node_modules/ .next/standalone/node_modules/`,
            `rm -rf .next/standalone/${repository.repositoryName}`,
            'cp .env .env.production .next/standalone/',
            // https://nextjs.org/docs/advanced-features/output-file-tracing#automatically-copying-traced-files
            'rsync -av --ignore-existing public/ .next/standalone/public/',
            'rsync -av --ignore-existing .next/static/ .next/standalone/.next/static/',
            ],
        },
        },
        artifacts: {
        baseDirectory: '.next',
        files: ['**/*'],
        },
        cache: {
        paths: [
            'node_modules/**/*',
        ],
        },
    },
    }],
});

System information

  • amazonlinux 2
  • supabase-on-aws/tree/v0.7.0 -> master

This section indicates the use of 'studio' which may need to be updated to 'apps/studio'.

AWS Stack deploy fails in Amplify Frontend

Bug report

Describe the bug

The AWS Amplify build of the frontend fails (logs attached)
This also happens on latest, stable, and build 7.0

I recall one-click deploying in december, where everything worked out of the box.

To Reproduce

Deploy any AWS stack, i.e. "stable" to us-west-2.

Expected behavior

Build completes and supabase studio is reachable

Logs

2024-02-28T19:35:56.785Z [INFO]: # Starting phase: preBuild
                                 # Executing command: echo POSTGRES_PASSWORD=$(aws secretsmanager get-secret-value --secret-id $DB_SECRET_ARN --query SecretString | jq -r . | jq -r .password) >> .env.production
2024-02-28T19:35:57.451Z [INFO]: # Executing command: echo SUPABASE_ANON_KEY=$(aws ssm get-parameter --region $SUPABASE_REGION --name $ANON_KEY_NAME --query Parameter.Value) >> .env.production
2024-02-28T19:35:58.123Z [INFO]: # Executing command: echo SUPABASE_SERVICE_KEY=$(aws ssm get-parameter --region $SUPABASE_REGION --name $SERVICE_KEY_NAME --query Parameter.Value) >> .env.production
2024-02-28T19:35:58.804Z [INFO]: # Executing command: env | grep -e STUDIO_PG_META_URL >> .env.production
2024-02-28T19:35:58.806Z [INFO]: # Executing command: env | grep -e SUPABASE_ >> .env.production
2024-02-28T19:35:58.807Z [INFO]: # Executing command: env | grep -e NEXT_PUBLIC_ >> .env.production
2024-02-28T19:35:58.808Z [INFO]: # Executing command: cd ../
2024-02-28T19:35:58.809Z [INFO]: # Executing command: npx [email protected] prune --scope=studio
2024-02-28T19:35:59.598Z [WARNING]: npm
2024-02-28T19:35:59.607Z [WARNING]: WARN exec The following package was not found and will be installed: [email protected]
2024-02-28T19:36:00.603Z [INFO]: Generating pruned monorepo for studio in /codebuild/output/src4190248314/src/Supabase/out
2024-02-28T19:36:00.605Z [INFO]: - Added common
2024-02-28T19:36:00.605Z [INFO]: - Added config
2024-02-28T19:36:00.605Z [INFO]: - Added shared-data
2024-02-28T19:36:00.674Z [INFO]: - Added studio
2024-02-28T19:36:00.675Z [INFO]: - Added tsconfig
2024-02-28T19:36:00.709Z [INFO]: - Added ui
2024-02-28T19:36:00.790Z [INFO]: # Executing command: npm clean-install
2024-02-28T19:36:04.804Z [WARNING]: npm
2024-02-28T19:36:04.809Z [WARNING]: ERR! code EBADENGINE
                                    npm ERR! engine Unsupported engine
                                    npm ERR! engine Not compatible with your version of node/npm: [email protected]
                                    npm ERR! notsup Not compatible with your version of node/npm: [email protected]
                                    npm ERR! notsup Required: {"npm":">=9.0.0 <10.0.0","node":">=18.0.0 <19.0.0"}
                                    npm ERR! notsup Actual:   {"npm":"10.2.3","node":"v18.19.0"}
                                    npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-02-28T19_36_01_021Z-debug-0.log
2024-02-28T19:36:04.928Z [ERROR]: !!! Build failed
2024-02-28T19:36:04.929Z [INFO]: Please read more about Amplify Hosting's support for SSR frameworks to find if your build failure is related to an unsupported feature: https://docs.aws.amazon.com/amplify/latest/userguide/amplify-ssr-framework-support.html. You may also find this troubleshooting guide useful: https://docs.aws.amazon.com/amplify/latest/userguide/troubleshooting-ssr-deployment.html
2024-02-28T19:36:04.929Z [ERROR]: !!! Error: Command failed with exit code 1
2024-02-28T19:36:04.929Z [INFO]: # Starting environment caching...
2024-02-28T19:36:04.929Z [INFO]: # Environment caching completed
Terminating logging...

Support supabase_vault

Feature request

Is your feature request related to a problem? Please describe.

supabase_vault is launched.

Describe the solution you'd like

supabase_vault is supported in RDS/Aurora

Describe alternatives you've considered

N/A

Additional context

N/A

DB password rotation without EventBridge/CloudTrail

Feature request

Is your feature request related to a problem? Please describe.

Secrets Manager and Parameter Store both have db password. When Secrets Manager is rotated, EventBridge/CloudTrail hooks Lambda function to propagate password to Parameter Store.

If not CloudTrail enabled, the propagation is failed. The rotation function should update Parameter Store directly.

Describe the solution you'd like

Modify the rotation function to update Parameter Store directly.

Describe alternatives you've considered

N/A

Additional context

N/A

How to use RDS Postgres instead of RDS Aurora

Feature request

How to use RDS Postgres instead of RDS Aurora

Is your feature request related to a problem? Please describe.

I need to use Supabase with the Postgres vector extension and apparently RDS Aurora v2 doesn't support this extension.

Describe the solution you'd like

How do I generate or change the Cloudformation stack so that it creates the database on a traditional AWS RDS Postgres instance instead of using RDS Aurorar serverless?

Support realtime v2.x

Feature request

Is your feature request related to a problem? Please describe.

Realtime v2.0.0 was released.
https://github.com/supabase/realtime/releases/tag/v2.0.0

I want to run it with self-hosted supabase.

Describe the solution you'd like

Need to change some configurations to adapt v2.x, such as environment variables.

Describe alternatives you've considered

N/A

Additional context

N/A

CDK DEPLOY error

Bug report

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to '…'
  2. Click on '…'
  3. Scroll down to '…'
  4. See error

Expected behavior

I dont Know What iam doing wrong. but up on deploy this errror shows up from aws

Screenshots

image

If applicable, add screenshots to help explain your problem.

System information

using from codespace template on this repo

Additional context

Add any other context about the problem here.

This template is not available for ap-northeast-3 (Osaka)

Bug report

Describe the bug

This template is not available for ap-northeast-3 (Osaka).
(Amplify is not supported in ap-northeast-3.)

And my guess, v0.2.16 too. (due to Cognito user pools)

To Reproduce

See screenshots, please.

Expected behavior

Screenshots

image
image

  • All parameters are defaults.

image

System information

  • OS: Windows Server 2019 (on EC2)
  • Browser: Chrome 108.0.5359.125

Additional context

Realtime WebSocket connection fails

Bug report

Describe the bug

All works well other than realtime pg connection. browser throws the following
Screenshot 2023-07-31 at 6 50 18 PM

When I look on AWS ECS on the RealtimeService logs I see a lot of

project=realtime external_id=realtime [error] Auth error: tenant `realtime` not found`

When I look at the realtime.tenants table I only see one entry and the name is realtime-dev so I suspect this is the issue.

If this is the issue, what's a good way to solve this other than editing this field directly in the DB?

Unable to Locate Anon Key and Service Key in AWS Secret Manager

Describe the problem

I am facing difficulties in locating the Anon Key and Service Key within AWS Secret Manager for my Next.js project. I have explored the AWS Secret Manager interface thoroughly but have not been able to find these keys.

Is there a specific process or location within AWS Secret Manager where I should be looking for these keys? Your guidance on this matter would be greatly appreciated as I need these keys for my Next.js project.

Thank you.

Enhancing Upgrade Methods Standardization

Improve documentation for upgrading existing deployments

Describe the issue

The current documentation lacks guidance on how to upgrade existing deployments.

Describe the proposed improvements

To address this issue, the following enhancements to the documentation are suggested:

  1. Auto update and re-deployment: Provide clear instructions on enabling automatic updates and re-deployment for existing deployments. This will help users ensure their deployments are always up to date without manual intervention.

  2. Documenting manual upgrading: Include detailed steps and best practices for manually upgrading existing deployments. This will provide guidance for users who prefer a manual approach or have specific requirements that cannot be met through automatic updates.

Additional context

It's important to consider that not all users are highly experienced with AWS. By improving the documentation, we can support a wider range of users in effectively upgrading their deployments.

type \"extensions.http_request\" does not exist

Bug report

Describe the bug

A 500 Bad Request was encountered while performing a delete

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to '…'
  2. Click on '…'
  3. Scroll down to '…'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

image ## System information
  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

Read / Write spliting

    const pgpool = new SupabaseService(this, 'Pgpool', {
      cluster,
      containerDefinition: {
        image: ecs.ContainerImage.fromRegistry('public.ecr.aws/bitnami/pgpool:4'),
        portMappings: [{ containerPort: 5432 }],
        environment: {
          PGPOOL_BACKEND_NODES: `0:${db.clusterEndpoint.hostname}:${db.clusterEndpoint.port}:0::ALWAYS_MASTER|DISALLOW_TO_FAILOVER,1:${db.clusterReadEndpoint.hostname}:${db.clusterReadEndpoint.port}:1::DISALLOW_TO_FAILOVER`,
          PGPOOL_ENABLE_LOAD_BALANCING: 'yes',
          PGPOOL_ENABLE_STATEMENT_LOAD_BALANCING: 'yes',
          PGPOOL_SR_CHECK_PERIOD: '0',
          PGPOOL_HEALTH_CHECK_PERIOD: '0',
        },
        secrets: {
          PGPOOL_SR_CHECK_DATABASE: ecs.Secret.fromSecretsManager(dbSecret, 'dbname'),
          PGPOOL_SR_CHECK_USER: ecs.Secret.fromSecretsManager(dbSecret, 'username'),
          PGPOOL_SR_CHECK_PASSWORD: ecs.Secret.fromSecretsManager(dbSecret, 'password'),
          PGPOOL_POSTGRES_USERNAME: ecs.Secret.fromSecretsManager(dbSecret, 'username'),
          PGPOOL_POSTGRES_PASSWORD: ecs.Secret.fromSecretsManager(dbSecret, 'password'),
          PGPOOL_ADMIN_USERNAME: ecs.Secret.fromSecretsManager(pgpoolSecret, 'username'),
          PGPOOL_ADMIN_PASSWORD: ecs.Secret.fromSecretsManager(pgpoolSecret, 'password'),
        },
        healthCheck: {
          command: ['CMD', '/opt/bitnami/scripts/pgpool/healthcheck.sh'],
          interval: cdk.Duration.seconds(10),
          timeout: cdk.Duration.seconds(5),
          retries: 5,
        },
      },
      cpuArchitecture: 'x86_64',
      cpu: fargateTaskSize.findInMap(pgpoolTaskSize.valueAsString, 'cpu'),
      memory: fargateTaskSize.findInMap(pgpoolTaskSize.valueAsString, 'memory'),
      minTasks: pgpoolMinTasks.valueAsNumber,
      maxTasks: pgpoolMaxTasks.valueAsNumber,
    });

Supabase Realtime does not works

次のようなエラーが出て動作しない。

2022-08-01 05:55:37.522 [error] %Postgrex.Error{connection_id: 16700, message: nil, postgres: %{code: :object_in_use, file: "slot.c", line: "464", message: "replication slot \"supabase_realtime_rls\" is active for PID 12303", pg_code: "55006", routine: "ReplicationSlotAcquire", severity: "ERROR", unknown: "ERROR"}, query: nil}

この状態でつなぎに行くと

2022-08-01 05:56:11.784 [info] CONNECTED TO RealtimeWeb.UserSocket in 245µs
  Transport: :websocket
  Serializer: Phoenix.Socket.V1.JSONSerializer
  Parameters: %{"apikey" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTY1ODk2NzE2NiwiZXhwIjoxOTc0NTQzMTY2LCJpc3MiOiJzdXBhYmFzZSJ9.yjbFON28xWRS-U4GhOtIvkUD0gjEr4NmKb7Kzgw-XI8", "vsn" => "1.0.0"}

2022-08-01 05:56:14.826 [error] %RuntimeError{message: "operation :rollback is manually rolling back, which is not supported by Ecto.Multi"}

2022-08-01 05:56:14.826 [info] REFUSED JOIN realtime:public:messages in 18ms
  Parameters: %{"user_token" => "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTY1ODk2NzE2NiwiZXhwIjoxOTc0NTQzMTY2LCJpc3MiOiJzdXBhYmFzZSJ9.yjbFON28xWRS-U4GhOtIvkUD0gjEr4NmKb7Kzgw-XI8"}

2022-08-01 05:56:14.845 [error] %Postgrex.Error{connection_id: 16700, message: nil, postgres: %{code: :undefined_object, file: "slot.c", line: "418", message: "replication slot \"supabase_realtime_rls\" does not exist", pg_code: "42704", routine: "ReplicationSlotAcquire", severity: "ERROR", unknown: "ERROR"}, query: nil}

How to update JWT secrets/tokens?

Improve documentation

Describe the problem

I've been struggling to figure out how to rotate the anon and service API tokens. I see that there's a JWTSecret in Secrets Manager that the JsonWebTokenFunction lambda pulls from to generate the JWTs. And I can see that Supabase validates the JWTs using this same secret. If I wanted to change this JWTSecret value (either manually or programmatically), how can I force the JsonWebTokenFunction lambda to run again and regenerate the JWT tokens? Updating the stack doesn't seem to make the lambda run again. Thanks!

Describe the improvement

A clear and concise description of the improvement.

Additional context

Add any other context or screenshots that help clarify your question.

Managing Services on AWS

Improve documentation

Describe the problem

I am trying to get an idea of the general workflow when everything is serverless with aurora and fargate.

  • Do we need to login to a supabase.com account, or do we just need to supabase link to connect the remote?
  • What is the suggested approach for starting/stopping the AWS services (supabase start/stop)?
  • Info on pushing local migrations to remote db? Is it just supabase db push --db-url 'add-url-here'?
  • Is there a suggested approach for managing dev/staging/prod environments? Do we deploy a separate stack or each?
  • There was a note in the readme about managing the amount of resources. This looks like it will end up costing $150-$300 per month USD - is that expected?

Describe the improvement

A clear and concise set of descriptions on the items listed above.

Additional context

This is a beast of a community offerring. The stack builds and deploys using the CDK (you have to synth and bootstrap first) but it is a massive amount of AWS resources and whenever we run into issues, there is little to no documentation on using this.

Configurable AWS VPC - HOW TO

I think this could be useful for the community. Sometimes we need to deploy Supabase on an existing VPC. Perhaps that VPC have things configured like VPC peering, etc. and we don't want to repeat it manually in the new Supabase VCP.

These changes allow cdk deployments with a configurable VPC:

feat: add vpc_id as a context parameter

run cdk deploy if you want to deploy your Supabase within new VPC
run cdk deploy --context vpc_id=<some_vpcid> if you want to use existing VPC

To implement that, add to your supabase-on-aws repo the changes from this commit dd862ea

Yarn build on a clean clone fails

Bug report

Describe the bug

Bundling asset Supabase/Studio/Repository/ImportFunction/Code/Stage...
unknown shorthand flag: 'u' in -u
/Users/justin/Documents/repos/promptzero/helicone-on-aws/node_modules/aws-cdk-lib/core/lib/asset-staging.ts:468
      throw new Error(`Failed to bundle asset ${this.node.path}, bundle output is located at ${bundleErrorDir}: ${err}`);
            ^
Error: Failed to bundle asset Supabase/Studio/Repository/ImportFunction/Code/Stage, bundle output is located at /Users/justin/Documents/repos/promptzero/helicone-on-aws/cdk.out/asset.cacf47d179251c214c8728ecc90ed5906d9426afd63b1f1ee6992e03197368bc-error: Error: docker exited with status 16
--> Command: docker run --rm -u root -v "/Users/justin/Documents/repos/promptzero/helicone-on-aws/src/functions/copy-git-repo:/asset-input:delegated" -v "/Users/justin/Documents/repos/promptzero/helicone-on-aws/cdk.out/asset.cacf47d179251c214c8728ecc90ed5906d9426afd63b1f1ee6992e03197368bc:/asset-output:delegated" -w "/asset-input" "public.ecr.aws/sam/build-python3.9:latest-x86_64" "/bin/bash" -c "mkdir -p /var/task/local/{bin,lib}&&cp /usr/bin/git /usr/libexec/git-core/git-remote-https /usr/libexec/git-core/git-remote-http /var/task/local/bin&&ldd /usr/bin/git | awk 'NF == 4 { system(\"cp \" $3 \" /var/task/local/lib/\") }'&&ldd /usr/libexec/git-core/git-remote-https | awk 'NF == 4 { system(\"cp \" $3 \" /var/task/local/lib/\") }'&&ldd /usr/libexec/git-core/git-remote-http | awk 'NF == 4 { system(\"cp \" $3 \" /var/task/local/lib/\") }'&&pip install -r requirements.txt -t /var/task&&cp -au /asset-input/index.py /var/task&&cp -aur /var/task/* /asset-output"
    at AssetStaging.bundle (/Users/justin/Documents/repos/promptzero/helicone-on-aws/node_modules/aws-cdk-lib/core/lib/asset-staging.ts:468:13)
    at AssetStaging.stageByBundling (/Users/justin/Documents/repos/promptzero/helicone-on-aws/node_modules/aws-cdk-lib/core/lib/asset-staging.ts:331:10)
    at stageThisAsset (/Users/justin/Documents/repos/promptzero/helicone-on-aws/node_modules/aws-cdk-lib/core/lib/asset-staging.ts:197:35)
    at Cache.obtain (/Users/justin/Documents/repos/promptzero/helicone-on-aws/node_modules/aws-cdk-lib/core/lib/private/cache.ts:24:13)
    at new AssetStaging (/Users/justin/Documents/repos/promptzero/helicone-on-aws/node_modules/aws-cdk-lib/core/lib/asset-staging.ts:222:44)
    at new Asset (/Users/justin/Documents/repos/promptzero/helicone-on-aws/node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.ts:128:21)
    at AssetCode.bind (/Users/justin/Documents/repos/promptzero/helicone-on-aws/node_modules/aws-cdk-lib/aws-lambda/lib/code.ts:278:20)
    at new Function (/Users/justin/Documents/repos/promptzero/helicone-on-aws/node_modules/aws-cdk-lib/aws-lambda/lib/function.ts:726:29)
    at new Repository (/Users/justin/Documents/repos/promptzero/helicone-on-aws/src/aws-amplify-hosting.ts:162:27)
    at new AmplifyHosting (/Users/justin/Documents/repos/promptzero/helicone-on-aws/src/aws-amplify-hosting.ts:32:24)

Subprocess exited with error 1
👾 Task "build » post-compile » synth:silent" failed when executing "cdk synth -q" (cwd: /Users/justin/Documents/repos/promptzero/helicone-on-aws)

To Reproduce

Clone the repo and run yarn && yarn build

System information

  • OS: [macOS]
npx cdk --version
2.73.0 (build 43e681e)
docker --version    
Docker version 20.10.12, build e91ed57
npx projen --version
0.70.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.