Oh, I am currently on PG14.1 with the latest clien...
# help
w
Oh, I am currently on PG14.1 with the latest client version. Is it possible to manually select the PG version? Thanks, I'm going to check out some of these issues
g
No way to downgrade (or easily upgrade). New projects as of this week get 14.1. This is the main issue thread, but there are others.. https://github.com/supabase/supabase/issues/4201
realtime delete issue
w
I am also not seeing any subscription entries in the realtime db, might this be an issue? 🤔
g
I thought you had insert/update working?
my table does have all my subscriptions and filter info
w
It's definitely working with insert, but I might just search the wrong subscription table lol
g
your code above is definitely an insert working correctly
w
does your websocket
phx_join
message look like this?
do you mind sharing, what's your decoded user_token look like? I guess that's irrelevant as RLS is disabled nevertheless
g
going back to your insert. I glanced at it and thought that was a rt response. That looks just like an insert js response
w
No way, it's working. I just need to figure out what I did lol
g
my websocket join { "event": "phx_reply", "payload": { "response": {}, "status": "ok" }, "ref": "2", "topic": "realtime:public:room_status:id=eq.12" }
that has a filter, not using uuid and worked turning off the filter for delete.
i have a uuid one but it is on a table I can't easily fake a delete or generate a fake row.
w
I think the issue was the missing subscription entry caused by a missing email in my jwt payload 🙈
g
my join: { "topic": "realtime:public:room_status:id=eq.12", "event": "phx_join", "payload": { "user_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhdXRoZW50aWNhdGVkIiwiZXhwIjoxNjM4NjQzODU5LCJzdWIiOiI0N2ZjOTQwMS1hOBiLTQ0ZDEtOTk5NS04YmJjYWUxYTRlYTYiLCJlbWFpbCI6hhdhYmJvdHRAZ3JhcGVwYWQuY29tIiwicGhvbmUiOiIiLCJhcHBfbWV0YWRhdGEiOnsicHJvdmlkZXIiOiJlbWFpbCJ9LCJ1c2VyX21ldGFkYXRhIjp7fSwicm9sZSI6ImF1dGhlbnRpY2F0ZWQifQ.PbKbwVau3yx5NC9edHiYqps2c8O-Y0cbOe9D169SA10" }, "ref": "2" }
w
Are you using RLS? I am wondering if delete events are working for you with the supabase anon key
g
RLS is off on my RT tables
w
I adjusted the minted JWT (user_token) and it's working like a charm
However it's still not working with the provided anon_key from the supabase dashboard (with this key only inserts and updates are working)
Please don't tell me this is intentional and I am stupid 😆
g
Can you clarify that you are getting insert payload on the websocket when you insert a row into the table
w
do you mean with the "anonymous" or "authenticated" key?
g
well I think the insert response you showed me was you inserting a row into the table from the client. That is different that getting an RT response that a row inserted
this is my realtime message from the server if I update a column on the table:
Copy code
{
  "event": "UPDATE",
  "payload": {
    "columns": [
      {
        "name": "id",
        "type": "int8"
      },
      {
        "name": "created_at",
        "type": "timestamptz"
      },
      {
        "name": "updated_at",
        "type": "timestamptz"
      },
      {
        "name": "message_count",
        "type": "int4"
      },
      {
        "name": "note_count",
        "type": "int2"
      }
    ],
    "commit_timestamp": "2021-12-04T18:59:56.278752+00:00",
    "errors": null,
    "old_record": {
      "id": 12
    },
    "record": {
      "created_at": "2021-11-04T16:34:49+00:00",
      "id": 12,
      "message_count": 8,
      "note_count": 0,
      "updated_at": "2021-12-03T03:11:43.511+00:00"
    },
    "schema": "public",
    "table": "room_status",
    "type": "UPDATE"
  },
  "ref": null,
  "topic": "realtime:public:room_status:id=eq.12"
}
w
Ah I see. In my case it has to be an RT message, because I only used the dashboard for insert tests. Am I missing something?
g
hmmm weird insert update would use different names for event and record
w
Copy code
{
  "schema": "public",
  "table": "participant",
  "commit_timestamp": "2021-12-04T19:03:23.534831+00:00",
  "eventType": "INSERT",
  "new": {
    "created_at": "2021-12-04T19:03:14+00:00",
    "id": 26,
    "room_id": 5,
    "user_id": "722e64d0-f2c8-4b2b-8b43-5de5f0b42477"
  },
  "old": {}
}
that's what the message looks like, received from the realtime event handler
Copy code
{
  "event": "INSERT",
  "payload": {
    "columns": [
      {
        "name": "id",
        "type": "int8"
      },
      {
        "name": "created_at",
        "type": "timestamptz"
      },
      {
        "name": "room_id",
        "type": "int8"
      },
      {
        "name": "user_id",
        "type": "uuid"
      }
    ],
    "commit_timestamp": "2021-12-04T19:03:23.534831+00:00",
    "errors": null,
    "record": {
      "created_at": "2021-12-04T19:03:14+00:00",
      "id": 26,
      "room_id": 5,
      "user_id": "722e64d0-f2c8-4b2b-8b43-5de5f0b42477"
    },
    "schema": "public",
    "table": "participant",
    "type": "INSERT"
  },
  "ref": null,
  "topic": "realtime:public:participant:room_id=eq.5"
}
that's the same message (raw I guess) from the websocket
g
ah I was conused you were looking at websocket at one point. Yes that is the same format in the js payload in console.
So I agree insert is working...LOL
w
Oh my bad, sorry for the confusion lmao
g
So for sure delete is togged on in replication?
w
so it's working, but I am quite not sure why it does not work with the anon_key
it's now also working with delete events
g
Magic!
w
Thanks for helping out, I really appreciate it 🙂
g
Hope no one reads this thread for help though....
w
hm today I learned: realtime
delete
events won't work with unauthenticated users
and their connection won't be inserted into the
realtime.subscription
table