Comments (25)
@relferreira Realtime RLS no longer returns unchanged_toast
. You'll have to set REPLICA IDENTITY
to FULL
If you would like the unchanged column(s) outputted. Please see #223 for more context.
from realtime.
Just as a gentle reminder, the latest
docker image for supabase/realtime
still has this bug. I tracked it down to this issue and rebuilt from the latest code in the repo using the provided Dockerfile
and it has resolved.
from realtime.
@relferreira thanks for confirming! we'll look into this
from realtime.
@w3b6x9 I don't know if it helps, but this table has 2 json columns
from realtime.
The problem seems to be in the channel notifier
realtime/server/lib/realtime/subscribers_notification.ex
Lines 63 to 69 in f830e3e
You can see the definition of NewRecord
, UpdateRecord
and DeleteRecord
are slightly different in that NewRecord
has a record
field, same for UpdateRecord
. When we delete a record there is no new record but only an old_record
.
realtime/server/lib/adapters/changes.ex
Lines 5 to 12 in f830e3e
I can fix this quickly to send all types of changes to the channel.
How did you trigger the deletion?
from realtime.
same for UpdateRecord
Note that UpdateRecord will only receive the old value in some cases:
[OPTIONAL] If you want to recieve the old record (previous values) on UDPATE and DELETE, you can set the REPLICA IDENTITY to FULL like this: ALTER TABLE your_table REPLICA IDENTITY FULL;. This has to be set for each table unfortunately.
Logger.info inspect(eq)
We should change this to a debug
rather than info
How did you trigger the deletion?
@awalias did you have a repo you're testing on? Othewise I can mock it up into the Next.js example for testing
from realtime.
sorry, this was on a user's box so I don't have the delete details
from realtime.
hotfixed with 2ece7b1 I'm guessing it will need further work to cover the cases you mentioned above?
from realtime.
That's perfect @awalias - should work for UPDATE
too
from realtime.
getting a different error now:
2020-06-05 17:18:44.270 [info] Running RealtimeWeb.Endpoint with cowboy 2.6.3 at :::4000 (http)
2020-06-05 17:18:44.270 [info] Access RealtimeWeb.Endpoint at http://localhost:4000
2020-06-05 17:18:44.330 [info] "realtime:public"
2020-06-05 17:18:44.330 [info] "realtime:public:dashboard"
2020-06-05 17:18:44.330 [info] "realtime:public:dashboard:id=eq.<REDACTED>"
2020-06-05 17:18:44.331 [info] "realtime:public:dashboard:name=eq.Saver.nu"
2020-06-05 17:18:44.332 [error] GenServer Realtime.SubscribersNotification terminating
** (ArgumentError) argument error
:erlang.bit_size(:unchanged_toast)
(realtime) anonymous fn/3 in Realtime.SubscribersNotification.notify_subscribers/1
(elixir) lib/enum.ex:789: anonymous fn/3 in Enum.each/2
(stdlib) maps.erl:232: :maps.fold_1/3
(elixir) lib/enum.ex:1964: Enum.each/2
(realtime) lib/realtime/subscribers_notification.ex:64: anonymous fn/3 in Realtime.SubscribersNotification.notify_subscribers/1
(elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
(realtime) lib/realtime/subscribers_notification.ex:44: Realtime.SubscribersNotification.notify_subscribers/1
Last message (from #PID<0.2578.0>): {:notify, %Realtime.Adapters.Changes.Transaction{changes: [%Realtime.Adapters.Changes.UpdatedRecord{columns: [%Realtime.Decoder.Messages.Relation.Column{flags: [:key], name: "id", type: "uuid", type_modifier: 4294967295}, %Realtime.Decoder.Messages.Relation.Column{flags: [], name: "name", type: "text", type_modifier: 4294967295}, %Realtime.Decoder.Messages.Relation.Column{flags: [], name: "products", type: "jsonb", type_modifier: 4294967295}, %Realtime.Decoder.Messages.Relation.Column{flags: [], name: "sources", type: "jsonb", type_modifier: 4294967295}, %Realtime.Decoder.Messages.Relation.Column{<REDACTED>}
2020-06-05 17:18:44.334 [error] GenServer #PID<0.2578.0> terminating
** (stop) exited in: GenServer.call(Realtime.SubscribersNotification, {:notify, %Realtime.Adapters.Changes.Transaction{changes: [%Realtime.Adapters.Changes.UpdatedRecord{columns: [%Realtime.Decoder.Messages.Relation.Column{flags: [:key], name: "id", type: "uuid", type_modifier: 4294967295}, %Realtime.Decoder.Messages.Relation.Column{flags: [], name: "name", type: "text", type_modifier: 4294967295}, %Realtime.Decoder.Messages.Relation.Column{flags: [], name: "products", type: "jsonb", type_modifier: 4294967295}, %Realtime.Decoder.Messages.Relation.Column{flags: [], name: "sources", type: "jsonb", type_modifier: 4294967295}, %Realtime.Decoder.Messages.Relation.Column{<REDACTED>)
** (EXIT) an exception was raised:
** (ArgumentError) argument error
:erlang.bit_size(:unchanged_toast)
(realtime) anonymous fn/3 in Realtime.SubscribersNotification.notify_subscribers/1
(elixir) lib/enum.ex:789: anonymous fn/3 in Enum.each/2
(stdlib) maps.erl:232: :maps.fold_1/3
(elixir) lib/enum.ex:1964: Enum.each/2
(realtime) lib/realtime/subscribers_notification.ex:64: anonymous fn/3 in Realtime.SubscribersNotification.notify_subscribers/1
(elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
(realtime) lib/realtime/subscribers_notification.ex:44: Realtime.SubscribersNotification.notify_subscribers/1
(elixir) lib/gen_server.ex:1009: GenServer.call/3
(realtime) lib/realtime/replication.ex:84: Realtime.Replication.process_message/2
(realtime) lib/realtime/replication.ex:56: Realtime.Replication.handle_info/2
(stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
(stdlib) gen_server.erl:711: :gen_server.handle_msg/6
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:epgsql, #PID<0.2579.0>, {:x_log_data, 110555416, 110555416, <<67, 0, 0, 0, 0, 0, 6, 150, 240, 232, 0, 0, 0, 0, 6, 150, 241, 24, 0, 2, 74, 12, 113, 75, 65, 82>>}}
from realtime.
I can't reproduce this. I tried to delete and update rows manually using psql
and the process does not crash.
from realtime.
Last message: {:epgsql, #PID<0.2579.0>, {:x_log_data, 110555416, 110555416, <<67, 0, 0, 0, 0, 0, 6, 150, 240, 232, 0, 0, 0, 0, 6, 150, 241, 24, 0, 2, 74, 12, 113, 75, 65, 82>>}}
We might be able to run this through one of the tests scripts to replicate. I'm a bit tied up but can get to this later tonight or early tmr
edit: not sure this is the correct way to replicate. I created a test but it looks like a red herring - the error above is failing on Realtime.SubscribersNotification.notify_subscribers
my test is failing in the genserver (likely because I'm not feeding in the correct data or to the correct genserver)
Will have to think of another way to replicated
from realtime.
@awalias can you let us know where you are finding these errors? On the customer boxes? Are they definitely on the latest commit?
from realtime.
OK found the cause of the error:
%{
"id" => "17ce1beb-f4ed-4d6c-a1e0",
"name" => "Saver.nu",
"products" => :unchanged_toast,
"showEUR" => "t",
"sources" => "[{\"id\": \"c5e37367-39d7-4182-9459\", \"name\": \"redacted\"}}]"
}
Fails on this:
if v != nil do
eq = table_topic <> ":" <> k <> "=eq." <> v
RealtimeWeb.RealtimeChannel.handle_realtime_transaction(eq, change)
end
The cause must be sources
which is a stringified array "[{\"id\": \"c5e37367-39d7-4182-9459\", \"name\": \"redacted\"}}]"
, and then it cant send out the notify to the RealtimeChannel
@fracek's suggested improvements would solve this (we wouldn't do an equality check on an array) - table_topic <> ":" <> k <> "=eq." <> v
For now we will have to patch/avoid these sort of strings. Checking the best ways now. @fracek any suggestion?
from realtime.
actually "products" => :unchanged_toast,
is the culprit. Fixing
from realtime.
@awalias this is fixed. I don't know the release process that you're using for KPS. Should I bump it ? https://github.com/supabase/realtime#releases
from realtime.
Reopening until this is patched & deployed
from realtime.
thanks guys for getting to the bottom of this
I will bump and release tonight
from realtime.
shipping
from realtime.
Interesting. thanks for the follow up @kwakwaversal - not sure why it isn't yet shipped to docker
from realtime.
Hello, I'm seen this error in the SaaS Supabase:
from realtime.
@relferreira thanks for reporting your error. Were you listening to row level changes (e.g. teams:id=eq.taua
) when this error occurred?
from realtime.
Hello @w3b6x9, yes:
const mySubscription = supabase
.from(`teams:id=eq.${team}`)
.on('UPDATE', payload => {
console.log('Change received!', payload);
// setTeamInfo(payload.new);
})
.subscribe();
from realtime.
@relferreira alright so you can circumvent this issue by either setting your teams
table's replica identity to FULL
(ALTER TABLE teams REPLICA IDENTITY FULL;
) or simply ignore it since there are no changes.
from realtime.
Hello @w3b6x9,
It's been a long time, but thank you for the response.
I think that in the latest release, the unchanged_toast
is not returning anymore. It is a bug, or was something planned?
Thanks in advance.
from realtime.
Related Issues (20)
- Realtime version and release don't match HOT 1
- log_min_messages requires elevated privileges HOT 1
- Docker hub `latest` image tag is very old HOT 3
- What version of realtime is hosted Supabase using? HOT 1
- Add region to all Logger metadatas
- Realtime: Self Hosting - Docker Swarm mode HOT 6
- Docker-compose file appears to be broken HOT 40
- Unable to use null filters like 'parent IS NULL' in supabase realtime. HOT 3
- How is postgres binary data serialized?
- > Does supabase have null filters? HOT 1
- Self hosted : failed to connect: ** (Postgrex.Error) ssl not available HOT 1
- Startup error running migrations: table identifier does not refer to an existing ETS table HOT 8
- Erroneous public.test_tenant file from Supabase Realtime Migrations HOT 5
- Supabase Realtime Subscript Fails With Undefined Error (Possibly: `Auth error: tenant 'realtime-dev' not found` HOT 15
- supabase realtime not working HOT 26
- Seeds broken in latest docker image HOT 2
- horizontal scaling for self-hosted realtime servers, for broadcast and presence features HOT 5
- HTTP 431 & Realtime Subscriptions Failing HOT 11
- Realtime event broadcasting through REST calls does not work HOT 8
- Excessive logs being printed to STD OUT/ERR HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realtime.