Error with realtime.send function, says it does not exist

Goal: Using Supabase real time according to the docs to broadcast a message to client once a row is updated in a table so client can handle it approriately Problem: I followed these instructions and setup the connection and the trigger like so:
CREATE OR REPLACE FUNCTION dev.notify_project_deployment()
RETURNS TRIGGER AS $$
BEGIN
PERFORM realtime.send(
'deployment:' || NEW.project_id::text,
'deployment_updated',
jsonb_build_object(
'id', NEW.id,
'project_id', NEW.project_id,
'session_id', NEW.session_id,
'is_successful', NEW.is_successful,
'git_sha', NEW.git_sha
),
true -- private channel
);
RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;

CREATE TRIGGER deployment_trigger
AFTER UPDATE ON dev.project_deployment
FOR EACH ROW
EXECUTE FUNCTION dev.notify_project_deployment();
CREATE OR REPLACE FUNCTION dev.notify_project_deployment()
RETURNS TRIGGER AS $$
BEGIN
PERFORM realtime.send(
'deployment:' || NEW.project_id::text,
'deployment_updated',
jsonb_build_object(
'id', NEW.id,
'project_id', NEW.project_id,
'session_id', NEW.session_id,
'is_successful', NEW.is_successful,
'git_sha', NEW.git_sha
),
true -- private channel
);
RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;

CREATE TRIGGER deployment_trigger
AFTER UPDATE ON dev.project_deployment
FOR EACH ROW
EXECUTE FUNCTION dev.notify_project_deployment();
https://supabase.com/docs/guides/realtime/getting_started?queryGroups=language&language=ts#4-set-up-authorization But its giving an error:
Error updating project deployment result in supabase: function realtime.send(text, unknown, jsonb, boolean) does not exist
Error updating project deployment result in supabase: function realtime.send(text, unknown, jsonb, boolean) does not exist
No description
3 Replies
garyaustin
garyaustin2w ago
Looks like the order is wrong in the doc... I find this definition in the source code. Not the JSONB comes first.
No description
garyaustin
garyaustin2w ago
And also this other example in the docs:
No description
Fermented Cheese
Fermented CheeseOP2w ago
thanks for the info!

Did you find this page helpful?