supabase-community / supabase-on-aws

Self-hosted Supabase on AWS
Apache License 2.0
403 stars 57 forks source link

Realtime Not Working #94

Open ConProgramming opened 5 months ago

ConProgramming commented 5 months ago

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.

ConProgramming commented 5 months ago

It seems it's trying but failing to connect to itself? The unable to connect to is its own IP.

ethanstan commented 5 months ago

Also having issues with this

ConProgramming commented 5 months ago
Screenshot 2024-05-05 at 3 17 03 PM

My database doesn't have a _realtime schema, only a realtime schema, and it has this. Nowhere in my database is tables for broadcasts / channels / presences / subscription, like how supabase.com has.

dubscode commented 5 months ago

I am dealing with this too. In the tenants table I found that my tenant was called realtime-dev-tenant, and the code was looking for realtime-dev

I updated this code in supabase-stack image

And now I am getting a signature error in the logs, so maybe a step in the right direction:

image

Still debugging but thought I'd share in case it helps someone sort this out. Thanks

ConProgramming commented 5 months ago

I am dealing with this too. In the tenants table I found that my tenant was called realtime-dev-tenant, and the code was looking for realtime-dev

I updated this code in supabase-stack image

And now I am getting a signature error in the logs, so maybe a step in the right direction: image

Still debugging but thought I'd share in case it helps someone sort this out. Thanks

If you clear out the requirements schema, then update the version of realtime in the stack to the latest image: ecs.ContainerImage.fromRegistry('public.ecr.aws/supabase/realtime:v2.28.34'), and redeploy, it'll correctly insert as realtime-dev instead of realtime-dev-tenant

ConProgramming commented 5 months ago

Hey @mats16 would love some help here 🙏❤️

ConProgramming commented 5 months ago

Update: The self host docker seems to have the same problem by default. Weirdly, the cli docker works fine. Looking into this.

ConProgramming commented 5 months ago

Now, the websocket for realtime fails with a 426 response. For example, using websocat

websocat "ws://MYPUBLICIP/realtime/v1/websocket?apikey=XYZ&vsn=1.0.0" 
websocat: WebSocketError: WebSocketError: Received unexpected status code (426 Upgrade Required)
websocat: error running

And kong logs at the same time

"GET /realtime/v1/websocket?apikey=XYZ&vsn=1.0.0 HTTP/1.0" 426 0 "-" "-" kong_request_id: "XYZ"

Using websocat on a project on supabase.com, it connects correctly.

ConProgramming commented 5 months ago
Screenshot 2024-05-08 at 9 37 50 AM

Am also now getting these logs in my realtime

@dubscode How goes over there? Did healthcheck improve your issue?

dubscode commented 5 months ago

Hi @ConProgramming I paused trying to troubleshoot on this repo and started to take a stab at setting this up using SST. I use SST a lot and have setup RDS quite a few times using it and CDK, but have not utilized the Service construct before for container images, so learning as I go, but pretty confident it can work out. I have an extremely "Work in Progress" shell setup here if you wanted: https://github.com/dubscode/supabase-sst Feel free to use it if you want. I'll contribute on it as I can

ConProgramming commented 5 months ago

Now, the websocket for realtime fails with a 426 response. For example, using websocat

websocat "ws://MYPUBLICIP/realtime/v1/websocket?apikey=XYZ&vsn=1.0.0" 
websocat: WebSocketError: WebSocketError: Received unexpected status code (426 Upgrade Required)
websocat: error running

And kong logs at the same time

"GET /realtime/v1/websocket?apikey=XYZ&vsn=1.0.0 HTTP/1.0" 426 0 "-" "-" kong_request_id: "XYZ"

Using websocat on a project on supabase.com, it connects correctly.

This 426 was from a Nginx bastion in front of Kong blocking websocket headers. Wish realtime would've had better logs for this, but after I fixed Nginx this is up and running. Now it's just a matter of merging #95