Skip to content

Realtime doesn't work out of the box or am I missing something? does anyone have it run successfully? #81

Open
@virtuman

Description

@virtuman

Using latest version of the chart with more or less default values, except for persistent storage and custom KEYs.

everything spins up and looks like it's working, but at least a couple of issues that I can't figure out:

  1. Realtime doesn't seem to work at all, when i try to signup, it says either CHANNEL_ERROR or timeout. I tried using supabase-js and supabase-py, as well as realtime-py packages. Either I can't figure out if I need to change the connection hostname or API Key ?
  2. Notifications do not seem to emit from postgres (that is installed using this helm chart repo)
  3. Google AUTH is excessively difficult to figure out for me nextjs - based app

But realtime is the one that's critical to me and it was the main reason for picking supabase for development.

Stock install of helm chart
Here's the code snippet in nodejs

import { createClient } from '@supabase/supabase-js';

// Supabase credentials
const SUPABASE_URL = 'https://supabase.domain.com'; // this points to kong ingress 
const SUPABASE_KEY = 'zzzzzzzzzzzz_service_key_or_anon_key_value_here'

const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);

const handleError = (error) => {
	console.error('Subscription error:', error);
};

// Function to handle real-time changes
const handleInsert = (payload) => {
	console.log('Insert received:', payload);
};

const channel = supabase.channel('room_a', { broadcast: { ack: false, self: false } })

db.pool.connect((err, client) => {
	if(err) {
		console.log(err);
	}
	pgClient = client;
	client.on('notification', function(msg) {
		console.log('Hello i am new event ')
	});
	const query = client.query('LISTEN myEvent');
});

// Subscribe to real-time updates for the 'pair_meta' table
const setupRealTime = async () => {
	console.log('Setting up real-time subscription...');

	const channel = supabase
		.channel('pair_meta_channel')
		.on('INSERT', handleInsert)
		.on('UPDATE', handleInsert)
		.on('DELETE', handleInsert)
		.subscribe((status, error) => {
			console.log(`Subscription status: ${status}`);
			if (error) {
				handleError(error);
			}
			if (status === 'SUBSCRIBED') {
				console.log('Successfully subscribed to the channel');
			}
		});

	// Handle clean-up on exit
	process.on('SIGINT', async () => {
		console.log('Unsubscribing and exiting...');
		await supabase.removeSubscription(channel);
		process.exit();
	});
};

// Call the setup function
setupRealTime();

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions