-
-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot send or receive messages with self-hosted Realtime + hosted Supabase Postgres #372
Comments
We have an Should be very soon! |
that's great! when that's merged will it also be reflected in the latest Docker image? |
I'm also facing issues trying to use Realtime supabase locally: I'm using the latest supabase CLI locally w/ the supabase v2 js libraries in react, and I'm finding that realtime subscriptions to DB events isn't working. In the logs for the realtime container, I see the following 2 messages repeatedly:
In react, the realtime subscription code looks something like:
The subscription object has state set to "joined", and the channel shows up if I subsequently call supabase.getChannels(). But for some reason, the payload function is never called and the websocket messages received by the react client from the websocket server indicate the same error message repeatedly:
Are there any suggested workarounds for local development that needs real-time, until an update is merged? Thanks! |
@thecooltechguy did you remember to add the alter publication supabase_realtime add table chat_messages; |
@w3b6x9 THANK U SO MUCH! It turned out that I forgot to enable "Realtime" for the table after I upgraded my supabase local setup to use the latest container images. Now, realtime works locally! |
@Omarzipan try pointing the Realtime image at I'm currently updating Realtime's |
@w3b6x9. I have a docker compose setup. When I upgrade the image to
FYI - I also keep getting following warning
My docker-compose file for realtime is setup as follows
docker compose config with
|
I have the same issue, except
|
Here's what you can do to get it running locally:
...
realtime:
depends_on:
- db
image: supabase/realtime:v1.0.0-rc.14
container_name: realtime-server
ports:
- "4000:4000"
environment:
PORT: 4000
DB_HOST: host.docker.internal
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: postgres
DB_ENC_KEY: supabaserealtime
DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'
API_JWT_SECRET: dc447559-996d-4761-a306-f47a5eab1623
FLY_ALLOC_ID: fly123
FLY_APP_NAME: realtime
SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
ERL_AFLAGS: -proto_dist inet_tcp
ENABLE_TAILSCALE: false
DNS_NODES: "''"
command: sh -c "/app/bin/migrate && /app/bin/server"
curl -X POST \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIiLCJpYXQiOjE2NzEyMzc4NzMsImV4cCI6MTcwMjc3Mzk5MywiYXVkIjoiIiwic3ViIjoiIn0._ARixa2KFUVsKBf3UGR90qKLCpGjxhKcXY4akVbmeNQ' \
-d $'{
"tenant" : {
"name": "realtime-dev",
"external_id": "realtime-dev",
"jwt_secret": "a1d99c8b-91b6-47b2-8f3c-aa7d9a9ad20f",
"extensions": [
{
"type": "postgres_cdc_rls",
"settings": {
"db_name": "postgres",
"db_host": "host.docker.internal",
"db_user": "postgres",
"db_password": "postgres",
"db_port": "5432",
"region": "us-west-1",
"poll_interval_ms": 100,
"poll_max_record_bytes": 1048576,
"ip_version": 4
}
}
]
}
}' \
http://localhost:4000/api/tenants
I'm in the process of updating the README and will include the above instructions for easier local setup. |
THanks @w3b6x9 After making these changes I am getting following error
Here's my docker-compose file. I had to change db:
container_name: supabase-db
image: supabase/postgres:15.1.0.14
command: >
postgres -c config_file=/etc/postgresql/postgresql.conf
-c log_statement=all -c logging_collector=on
-c log_destination=csvlog -c log_directory=/var/log/postgresql
-c log_filename=postgresql -c log_min_messages=fatal
restart: unless-stopped
ports:
- ${PGPORT}:5432
environment:
POSTGRES_PASSWORD: ${PGPASSWORD}
volumes:
- /var/lib/postgresql/data
- ./volumes/db/init:/docker-entrypoint-initdb.d
- ${PROJECT_ROOT}/data/supabase/schema:/schema
realtime:
container_name: supabase-realtime
image: supabase/realtime:v1.0.0-rc.14
depends_on:
- db
restart: unless-stopped
environment:
PORT: 4000
DB_HOST: db
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: postgres
DB_ENC_KEY: supabaserealtime
DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'
API_JWT_SECRET: ${JWT_SECRET}
FLY_ALLOC_ID: fly123
FLY_APP_NAME: realtime
SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
ERL_AFLAGS: -proto_dist inet_tcp
ENABLE_TAILSCALE: false
DNS_NODES: "''"
command: sh -c "/app/bin/migrate && /app/bin/server" I have ran following sql to my db. When I ran INSERT INTO _realtime.tenants
(id, name, external_id, jwt_secret, inserted_at, updated_at)
VALUES (extensions.uuid_generate_v4(), 'realtime-dev', 'realtime-dev',
'your-super-secret-jwt-token-with-at-least-32-characters-long', NOW(), NOW());
INSERT INTO _realtime.extensions
(id, type, settings, tenant_external_id, inserted_at, updated_at)
VALUES (extensions.uuid_generate_v4(), 'postgres_cdc_rls',
json_build_object(
'db_name', 'postgres',
'db_host', 'db',
'db_user', 'postgres',
'db_password', 'postgres',
'db_port', '5432',
'poll_interval_ms', 100,
'poll_max_record_bytes', 1048576,
'ip_version', 4
), 'realtime-dev', NOW(), NOW()) my supabaseClient.channel(`${schema}:test`)
.on("postgres_changes", { event: "*", schema: schema, table: 'test' },
(payload) => console.log(payload)
)
.subscribe(); |
@bhvngt hmm it's strange that the
@bhvngt ah, the curl command was for |
I've streamlined this process further so now you don't have to run step 3 ( |
Thanks @w3b6x9.
I got that. Now I have it working.
I am not using supabase-cli and instead using docker compose directly with following config. For Step 5. Can I use @supabase/supabase-js or do I need to use @supabase/realtime-js or phoenix. kong:
container_name: supabase-kong
image: kong:2.1
restart: unless-stopped
ports:
- ${KONG_HTTP_PORT}:8000/tcp
- ${KONG_HTTPS_PORT}:8443/tcp
environment:
KONG_DATABASE: "off"
KONG_DECLARATIVE_CONFIG: /var/lib/kong/kong.yml
# https://github.com/supabase/cli/issues/14
KONG_DNS_ORDER: LAST,A,CNAME
KONG_PLUGINS: request-transformer,cors,key-auth,acl
volumes:
- ./volumes/api/kong.yml:/var/lib/kong/kong.yml
realtime:
container_name: supabase-realtime
image: supabase/realtime:v1.0.0-rc.14
depends_on:
- db
restart: unless-stopped
ports:
- "4100:4000"
environment:
PORT: 4000
DB_HOST: db
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: postgres
DB_ENC_KEY: supabaserealtime
DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'
API_JWT_SECRET: your-super-secret-jwt-token-with-at-least-32-characters-long
FLY_ALLOC_ID: fly123
FLY_APP_NAME: realtime
SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
ERL_AFLAGS: -proto_dist inet_tcp
ENABLE_TAILSCALE: false
DNS_NODES: "''"
command: sh -c "/app/bin/migrate && /app/bin/server"
db:
container_name: supabase-db
image: supabase/postgres:15.1.0.14
command: >
postgres -c config_file=/etc/postgresql/postgresql.conf
-c log_statement=all -c logging_collector=on
-c log_destination=csvlog -c log_directory=/var/log/postgresql
-c log_filename=postgresql -c log_min_messages=fatal
restart: unless-stopped
ports:
- ${PGPORT}:5432
environment:
POSTGRES_PASSWORD: ${PGPASSWORD}
volumes:
- /var/lib/postgresql/data
- ./volumes/db/init:/docker-entrypoint-initdb.d
- ${PROJECT_ROOT}/data/supabase/schema:/schema Here's the - name: realtime-v1
_comment: "Realtime: /realtime/v1/* -> ws://realtime:4000/socket/*"
url: http://realtime:4100/socket/
routes:
- name: realtime-v1-all
strip_path: true
paths:
- /realtime/v1/
plugins:
- name: cors
- name: key-auth
config:
hide_credentials: false
- name: acl
config:
hide_groups_header: true
allow:
- admin
- anon |
You can use either.
Yes, you'll have to update Realtime url to something like |
@w3b6x9 after following the yml configs i have this now: supabase-realtime | 10:37:22.565 [error] Could not create schema migrations table. This error usually happens due to the following:
supabase-realtime |
supabase-realtime | * The database does not exist
supabase-realtime | * The "schema_migrations" table, which Ecto uses for managing
supabase-realtime | migrations, was defined by another library
supabase-realtime | * There is a deadlock while migrating (such as using concurrent
supabase-realtime | indexes with a migration_lock)
supabase-realtime |
supabase-realtime | To fix the first issue, run "mix ecto.create". am i missing something? |
@itisnajim can you share your steps so I can try and reproduce? |
@w3b6x9 here is my full yml configs: docker-compose.yml version: "3.8"
services:
studio:
container_name: supabase-studio
image: supabase/studio:20221214-4eecc99
restart: unless-stopped
ports:
- ${STUDIO_PORT}:3000/tcp
environment:
STUDIO_PG_META_URL: http://meta:8080
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
DEFAULT_ORGANIZATION: ${STUDIO_DEFAULT_ORGANIZATION}
DEFAULT_PROJECT: ${STUDIO_DEFAULT_PROJECT}
SUPABASE_URL: http://kong:8000
SUPABASE_PUBLIC_URL: ${SUPABASE_PUBLIC_URL}
# Kept for backwards compatibility with studio:0.22.08
SUPABASE_REST_URL: ${API_EXTERNAL_URL}/rest/v1/
SUPABASE_ANON_KEY: ${ANON_KEY}
SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY}
kong:
container_name: supabase-kong
image: kong:2.8.1
restart: unless-stopped
ports:
- ${KONG_HTTP_PORT}:8000/tcp
- ${KONG_HTTPS_PORT}:8443/tcp
environment:
KONG_DATABASE: "off"
KONG_DECLARATIVE_CONFIG: /var/lib/kong/kong.yml
# https://github.com/supabase/cli/issues/14
KONG_DNS_ORDER: LAST,A,CNAME
KONG_PLUGINS: request-transformer,cors,key-auth,acl
KONG_NGINX_PROXY_PROXY_BUFFER_SIZE: 160k
KONG_NGINX_PROXY_PROXY_BUFFERS: 64 160k
volumes:
- ./volumes/api:/var/lib/kong:ro
auth:
container_name: supabase-auth
image: supabase/gotrue:v2.31.0
depends_on:
db: # Disable this if you are using an external Postgres database
condition: service_healthy
restart: unless-stopped
environment:
GOTRUE_API_HOST: 0.0.0.0
GOTRUE_API_PORT: 9999
API_EXTERNAL_URL: ${API_EXTERNAL_URL}
GOTRUE_DB_DRIVER: postgres
GOTRUE_DB_DATABASE_URL: postgres://supabase_auth_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POST>
GOTRUE_SITE_URL: ${SITE_URL}
GOTRUE_URI_ALLOW_LIST: ${ADDITIONAL_REDIRECT_URLS}
GOTRUE_DISABLE_SIGNUP: ${DISABLE_SIGNUP}
GOTRUE_JWT_ADMIN_ROLES: service_role
GOTRUE_JWT_AUD: authenticated
GOTRUE_JWT_DEFAULT_GROUP_NAME: authenticated
GOTRUE_JWT_EXP: ${JWT_EXPIRY}
GOTRUE_JWT_SECRET: ${JWT_SECRET}
GOTRUE_EXTERNAL_EMAIL_ENABLED: ${ENABLE_EMAIL_SIGNUP}
GOTRUE_MAILER_AUTOCONFIRM: ${ENABLE_EMAIL_AUTOCONFIRM}
# GOTRUE_MAILER_SECURE_EMAIL_CHANGE_ENABLED: true
# GOTRUE_SMTP_MAX_FREQUENCY: 1s
GOTRUE_SMTP_ADMIN_EMAIL: ${SMTP_ADMIN_EMAIL}
GOTRUE_SMTP_HOST: ${SMTP_HOST}
GOTRUE_SMTP_PORT: ${SMTP_PORT}
GOTRUE_SMTP_USER: ${SMTP_USER}
GOTRUE_SMTP_PASS: ${SMTP_PASS}
GOTRUE_SMTP_SENDER_NAME: ${SMTP_SENDER_NAME}
GOTRUE_MAILER_URLPATHS_INVITE: ${MAILER_URLPATHS_INVITE}
GOTRUE_MAILER_URLPATHS_CONFIRMATION: ${MAILER_URLPATHS_CONFIRMATION}
GOTRUE_MAILER_URLPATHS_RECOVERY: ${MAILER_URLPATHS_RECOVERY}
GOTRUE_MAILER_URLPATHS_EMAIL_CHANGE: ${MAILER_URLPATHS_EMAIL_CHANGE}
GOTRUE_EXTERNAL_PHONE_ENABLED: ${ENABLE_PHONE_SIGNUP}
GOTRUE_SMS_AUTOCONFIRM: ${ENABLE_PHONE_AUTOCONFIRM}
MFA_ENABLED: ${MFA_ENABLED}
rest:
container_name: supabase-rest
image: postgrest/postgrest:v9.0.1.20220717
depends_on:
db: # Disable this if you are using an external Postgres database
condition: service_healthy
restart: unless-stopped
environment:
PGRST_DB_URI: postgres://authenticator:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POS>
PGRST_DB_SCHEMAS: ${PGRST_DB_SCHEMAS}
PGRST_DB_ANON_ROLE: anon
PGRST_JWT_SECRET: ${JWT_SECRET}
PGRST_DB_USE_LEGACY_GUCS: "false"
realtime:
container_name: supabase-realtime
image: supabase/realtime:v1.0.0-rc.14
depends_on:
db: # Disable this if you are using an external Postgres database
condition: service_healthy
restart: unless-stopped
ports:
- "4000:4000"
environment:
DB_HOST: ${POSTGRES_HOST}
DB_PORT: ${POSTGRES_PORT}
DB_NAME: ${POSTGRES_DB}
DB_USER: supabase_admin
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_SSL: "false"
PORT: 4000
JWT_SECRET: ${JWT_SECRET}
REPLICATION_MODE: RLS
REPLICATION_POLL_INTERVAL: 100
SECURE_CHANNELS: "true"
SLOT_NAME: supabase_realtime_rls
TEMPORARY_SLOT: "true"
DB_AFTER_CONNECT_QUERY: "SET search_path TO _realtime"
DB_ENC_KEY: supabaserealtime
FLY_ALLOC_ID: fly123
FLY_APP_NAME: realtime
SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
ERL_AFLAGS: -proto_dist inet_tcp
ENABLE_TAILSCALE: false
DNS_NODES: "''"
command: sh -c "/app/bin/migrate && /app/bin/server"
# command: >
# bash -c "./prod/rel/realtime/bin/realtime eval Realtime.Release.migrate
# && ./prod/rel/realtime/bin/realtime start"
storage:
container_name: supabase-storage
image: supabase/storage-api:v0.26.1
depends_on:
db: # Disable this if you are using an external Postgres database
condition: service_healthy
rest:
condition: service_started
restart: unless-stopped
environment:
ANON_KEY: ${ANON_KEY}
SERVICE_KEY: ${SERVICE_ROLE_KEY}
POSTGREST_URL: http://rest:3000
PGRST_JWT_SECRET: ${JWT_SECRET}
DATABASE_URL: postgres://supabase_storage_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PO>
FILE_SIZE_LIMIT: 52428800
STORAGE_BACKEND: file
FILE_STORAGE_BACKEND_PATH: /var/lib/storage
TENANT_ID: stub
# TODO: https://github.com/supabase/storage-api/issues/55
REGION: stub
GLOBAL_S3_BUCKET: stub
ENABLE_IMAGE_TRANSFORMATION: "true"
IMGPROXY_URL: http://imgproxy:5001
volumes:
- ./volumes/storage:/var/lib/storage
imgproxy:
container_name: supabase-imgproxy
image: darthsim/imgproxy:v3.11
environment:
IMGPROXY_BIND: ":5001"
IMGPROXY_LOCAL_FILESYSTEM_ROOT: /
IMGPROXY_USE_ETAG: "true"
volumes:
- ./volumes/storage:/var/lib/storage
meta:
container_name: supabase-meta
image: supabase/postgres-meta:v0.52.1
depends_on:
db: # Disable this if you are using an external Postgres database
condition: service_healthy
restart: unless-stopped
environment:
PG_META_PORT: 8080
PG_META_DB_HOST: ${POSTGRES_HOST}
PG_META_DB_PORT: ${POSTGRES_PORT}
PG_META_DB_NAME: ${POSTGRES_DB}
PG_META_DB_USER: supabase_admin
PG_META_DB_PASSWORD: ${POSTGRES_PASSWORD}
# Comment out everything below this point if you are using an external Postgres database
db:
container_name: supabase-db
image: supabase/postgres:14.1.0.89
healthcheck:
test: pg_isready -U postgres -h localhost
interval: 5s
timeout: 5s
retries: 10
command:
- postgres
- -c
- config_file=/etc/postgresql/postgresql.conf
- -c
- log_min_messages=fatal # prevents Realtime polling queries from appearing in logs
restart: unless-stopped
ports:
- ${POSTGRES_PORT}:5432
environment:
POSTGRES_HOST: /var/run/postgresql
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ./volumes/db/roles.sql:/docker-entrypoint-initdb.d/roles.sql volumes/api/kong.yml ## Secure Realtime routes
- name: realtime-v1
_comment: "Realtime: /realtime/v1/* -> ws://realtime:4000/socket/*"
url: http://realtime-dev.realtime:4000/socket
# url: http://realtime:4000/socket/
routes:
- name: realtime-v1-all
strip_path: true
paths:
- /realtime/v1/
plugins:
- name: cors
- name: key-auth
config:
hide_credentials: false
- name: acl
config:
hide_groups_header: true
allow:
- admin
- anon |
@w3b6x9 I could make it work by creating
Any thoughts on what I need to change in the kong config to make this work? My kong configuration is - name: realtime-v1
_comment: "Realtime: /realtime/v1/* -> ws://realtime:4100/socket/*"
url: http://realtime-dev.realtime:4100/socket/
routes:
- name: realtime-v1-all
strip_path: true
paths:
- /realtime/v1/
plugins:
- name: cors
- name: key-auth
config:
hide_credentials: false
- name: acl
config:
hide_groups_header: true
allow:
- admin
- anon and my test code is as follows import {createClient} from '@supabase/supabase-js'
const client = createClient(
"http://localhost:4000", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYyNzIwODU0MCwiZXhwIjoxOTc0MzYzNzQwfQ.zcaQfHd3VA7XgJmdGfmV86OLVJT9s2MTmSy-e69BpUY"
)
// This code works
// import { RealtimeClient } from '@supabase/supabase-js'
//
// const client = new RealtimeClient("http://realtime-dev.localhost:4100/socket", {
// params: {
// apikey: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYyNzIwODU0MCwiZXhwIjoxOTc0MzYzNzQwfQ.zcaQfHd3VA7XgJmdGfmV86OLVJT9s2MTmSy-e69BpUY",
// eventsPerSecond: 10,
// },
// })
client.channel('*')
.on('postgres_changes', {event: '*', schema: 'public'}, (payload) => {
console.log('All changes in public schema: ', payload)
})
.subscribe(async (status) => {
if (status === 'SUBSCRIBED') {
console.log(status)
}
}); |
getting the same error: supabase-kong | 2022/12/20 12:24:46 [error] 1110#0: *7798 [lua] init.lua:310: execute(): DNS resolution failed: dns server
error: 2 server failure. Tried: ["(short)realtime-dev.realtime:(na) - cache-miss","realtime-dev.realtime:1 - cache-
miss/scheduled/querying/dns server error: 2 server failure","realtime-dev.realtime:5 - cache-miss/scheduled/querying/dns
server error: 2 server failure"], client: 172.18.0.1, server: kong, request: "GET /realtime/v1/websocket?
apikey=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICAgInJvbGUiOiAiYW5vbiIsCiAgICAiaXNzIjogInN1cGFiYXNlIiwKICAgIC
JpYXQiOiAxNjcxNDA0NDAwLAogICAgImV4cCI6IDE4MjkxNzA4MDAKfQ.udoS9BfcrvA-
XIW5FrPLUYtnJIndKuDtX7zpCdXlrnE&vsn=1.0.0 HTTP/1.1", host: "supabase.example.com" |
@bhvngt how did you manage to fix this
using command: >
bash -c "./prod/rel/realtime/bin/realtime eval Realtime.Release.migrate
&& ./prod/rel/realtime/bin/realtime start" |
@itisnajim. Thats a good question, I did a check with my docker image digest and have since discovered that my image was incorrectly tagged. I was using v0.25.1. So, on pull of v1.0.0-rc.12 I get the same issue. |
@w3b6x9 wondering if you were able to download the self-host Supabase docker and start it with the modifications proposed in this issue, I am currently trying to do the same and have been encountering some difficulties. I was wondering if you could share any tips or guidance on how you were able to get it working. Thanks 🙏 |
Its finally working for me. Here's my docker-compose and here's my kong.yaml config to make it work. Here are the steps I took
import {createClient} from '@supabase/supabase-js'
const client = createClient(
"http://localhost:4000",
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYyNzIwODU0MCwiZXhwIjoxOTc0MzYzNzQwfQ.zcaQfHd3VA7XgJmdGfmV86OLVJT9s2MTmSy-e69BpUY"
)
// This will also work but will require change in /etc/hosts to include realtime-dev.localhost as an alias to localhost
// import { RealtimeClient } from '@supabase/realtime-js'
//
// const client = new RealtimeClient("http://realtime-dev.localhost:4100/socket", {
// params: {
// apikey: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYyNzIwODU0MCwiZXhwIjoxOTc0MzYzNzQwfQ.zcaQfHd3VA7XgJmdGfmV86OLVJT9s2MTmSy-e69BpUY",
// eventsPerSecond: 10,
// },
// })
client.channel('*')
.on('postgres_changes', {event: '*', schema: 'public'}, (payload) => {
console.log('All changes in public schema: ', payload)
})
.subscribe(async (status) => {
if (status === 'SUBSCRIBED') {
console.log(status)
}
}); Hopefully after the release of the next version of realtime image, step 2 may not be required. Key thing to note is that we need to give a separate hostname to realtime container that contains |
i still have one error, i think it's because
@bhvngt you have 3 volumes on i don't know the content of this ${PROJECT_ROOT}/data/supabase/schema, if you can help me |
@itisnajim, it is project specific schema volume. So wont be required for your realtime setup. |
mmm 🤔
|
Ok, I had time to get back to this. AFAICT the current docker quickstart still has one bug for running things locally. If you run everything normally, you'll get an error about a missing schema:
After some sleuthing it's because the To fix this:
Everything now works locally! cc @itisnajim since one of your posts had this error Originally, I wanted to self-host Realtime and hook it up to a hosted Supabase DB. I'm still a little confused as to how to do that. It seems like I'll need to create a tenant on the hosted Supabase DB, which I should be able to do via an API call to my self-hosted Realtime server? And is there a particular value for Since I mainly wanted to self-host this to get around limits with just the streaming functionality of Realtime (not trying to subscribe to table updates) I don't mind setting up a dummy DB on some cloud provider and using the current Docker setup. Since it seems like most people here want to self-host both the DB and Realtime, I'm happy to consider this closed and re-open a new issue for just the Self-Hosted Realtime <> Hosted Postgres steps! |
Thanks @Omarzipan for highlighting the cause of the error. I missed mentioning that I had to change the files kept under Here's the script I have added create schema if not exists _realtime;
create schema if not exists realtime;
create publication supabase_realtime with (publish = 'insert, update, delete'); |
I'm still having trouble setting up a nginx server block for a domain to work with
this is the payload used: {
"role": "service_role",
"iss": "Issuer",
"nbf": 1610078130,
"iat": 1672873200,
"exp": 1830639600
} The generated service role key: If anyone has experience with this and could provide some guidance, it would be greatly appreciated. Thanks in advance for your help. |
i was stupid, the JWT should be Line 15 in 569a33c
Now i have this error message is repeating on the terminal multiple times: [error] Could not create schema migrations table.
supabase-realtime | {%Postgrex.Error{
supabase-realtime | message: nil,
supabase-realtime | postgres: %{
supabase-realtime | code: :insufficient_privilege,
supabase-realtime | file: "aclchk.c",
supabase-realtime | line: "3447",
supabase-realtime | message: "permission denied for schema realtime",
supabase-realtime | pg_code: "42501",
supabase-realtime | position: "28",
supabase-realtime | routine: "aclcheck_error",
supabase-realtime | severity: "ERROR",
supabase-realtime | unknown: "ERROR"
supabase-realtime | },
supabase-realtime | connection_id: 552,
supabase-realtime | query: nil
supabase-realtime | }, in the flutter console no error(s) shown: |
Closing this issue b/c the cli and self-hosting (supabase/supabase#11457) Realtime versions are up to date. |
@bhvngt sorry to bother you again, i want to ask how did you get rid of this error:
|
@itisnajim I never got this error. Are you using the same |
@bhvngt , its a fresh download, i guess = https://github.com/supabase/supabase/blob/master/docker/docker-compose.yml#L117 https://github.com/supabase/supabase/blob/master/docker/.env.example#L18 i just created an issue in the main repo |
@itisnajim I am not using the latest download. I had manually created create schema if not exists _realtime;
create schema if not exists realtime;
create publication supabase_realtime with (publish = 'insert, update, delete'); Since Try setting |
i solved by replacing ${POSTGRES_USER} with supabase_admin realtime:
container_name: realtime-dev.supabase-realtime
image: supabase/realtime:v2.0.2
...
DB_USER: ${POSTGRES_USER} # should be DB_USER: supabase_admin code line: now the docker logs filled with:
|
restarting the docker and it shows no |
Hi @bhvngt
Here too. Every 10 seconds I receive this warning twice.
I am using a newer version of realtime (2.13.1) and I haven't actually checkt, if these messages are of any relevance. Did they go away when you changed your config? Are they related to a misconfiguration at all? Has anyone else has them? |
This commit addresses two key issues encountered while using the Supabase library in a self-hosted environment on AWS. 1. Realtime Service Not Functioning: - Identified Issue: Realtime service was non-operational, as discussed in supabase/realtime#372. - Resolution: Upgraded the Realtime Docker image from 'public.ecr.aws/supabase/realtime:v2.25.27' to 'public.ecr.aws/supabase/realtime:v2.25.60', resolving the issue. 2. StudioBranch Error: - Identified Issue: Updating StudioBranch from 'v0.23.09' to 'v0.23.11' resulted in an AWS Amplify CustomerError related to reading 'next' version in package.json (https://stackoverflow.com/questions/76296605/aws-amplify-customererror-cannot-read-next-version-in-package-json). - Temporary Solution: Reverted to version 'v0.23.09' and pushed via CodeCommit, which led to successful redeployment. This commit should enhance the stability and functionality of the Supabase library in similar self-hosted setups. Further investigation into the StudioBranch error is suggested for a more permanent solution.
@jsmueller7 did those warnings turn out to symptomatic of deeper problems or are they "normal" errors? |
Hi @AntonOfTheWoods , |
Bug report
Describe the bug
I am running a local web app that connects to a local version of Supabase Realtime running in Docker. The webapp uses supabase/realtime-js to connect to the realtime server. The Realtime server is connected to a hosted Postgres database on Supabase for my project.
This setup works when I point my web app to use Supabase's hosted Realtime servers. However, when I switch my realtime-js client library to point to my local Realtime server instead, I get an error.
On the client, I get a
CHANNEL_ERROR
and a null error object.On the Realtime server, I get the following error:
To Reproduce
On the client I'm using realtime-js:
On the backend I'm running the latest version of Realtime's Dockerfile from this repo, but modified the envvars with my Supabase Postgres settings.
Expected behavior
I would expect to be able to send and receive messages by using a self-hosted Realtime server with a hosted Supabase database.
Screenshots
n/a
System information
The text was updated successfully, but these errors were encountered: