Skip to content
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

UUID's in a smart cell chart do not work #192

Closed
the-destro opened this issue Aug 26, 2022 · 10 comments
Closed

UUID's in a smart cell chart do not work #192

the-destro opened this issue Aug 26, 2022 · 10 comments

Comments

@the-destro
Copy link

the-destro commented Aug 26, 2022

Current behavior

  1. query a simple table with UUID's with, say, a count and grouping by the id field
  2. Create a chart that tries to use UUID's on the x axis
  3. Get Error Failed to serialize initial widget data, invalid byte 0xC0 in <<uuid binary redacted>>

Expected behavior

No Error

Screen Shot 2022-08-26 at 10 30 41 AM

@josevalim josevalim transferred this issue from livebook-dev/livebook Aug 26, 2022
@josevalim
Copy link
Contributor

Notice this happens both on Kino.VegaLite but also on Kino.DataTable.

@jonatanklosko
Copy link
Member

@josevalim we can't serialize arbitrary binaries into JSON, so isn't this expect for UUIDs in the raw binary format?

@josevalim
Copy link
Contributor

@jonatanklosko we can actually encode, but I think the client really dislikes it:

iex(2)> Jason.encode <<0, 1, 2>>
{:ok, "\"\\u0000\\u0001\\u0002\""}

@jonatanklosko
Copy link
Member

iex> Jason.encode(Ecto.UUID.bingenerate())
{:error,
 %Jason.EncodeError{
   message: "invalid byte 0xAA in <<170, 141, 85, 72, 103, 180, 79, 91, 166, 160, 104, 128, 6, 179, 246, 193>>"
 }}

@josevalim
Copy link
Contributor

Oh, I see. And because of #180 the error only happens later, so it is a bit harder to provide earlier feedback?

@jonatanklosko
Copy link
Member

I think #180 doesn't change much in this specific case as there is no struct involved, so we would get the same error on either side. If we want a more specific error message we would need to match on %Jason.EncodeError{message: "invalid byte" <> _}.

@josevalim
Copy link
Contributor

With #180 I was thinking we would at least get an error from Kino and have it show up with stacktrace?

@josevalim
Copy link
Contributor

In any case, this can be closed. We might improve things with #180.

@josevalim josevalim closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 2022
@jonatanklosko
Copy link
Member

With #180 I was thinking we would at least get an error from Kino and have it show up with stacktrace?

Note that the serialization happens on demand, when someone connects to the component and it would be inside the Kino.JS.Live server, so I'm not sure if the stacktrace will be helpful. But maybe there's a way to show more relevant information, we can revisit :)

@03juan
Copy link
Contributor

03juan commented Jan 29, 2023

@the-destro did you manage to work around this issue?

This is practically the only page that comes up when searching for this error message so for anyone interested I solved this by explicitly casting the UUID to varchar in the kino_db smartcell query. Unfortunately it forced me to be explicit in the select statement and not just select * but rather select id::varchar, related_id::varchar, inserted_at etc...

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants