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

Application error: a client-side exception has occurred (see the browser console for more information). #94

Closed
beejaz opened this issue Aug 30, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@beejaz
Copy link

beejaz commented Aug 30, 2024

Bug report

Describe the bug

Created some tables, asked to fill it with dummy data, asked to fill some additional embeddings dummy data. Site crashed.
Going to the postgres.new shows previous stored conversation but when I load it, it crashes the website again. Similar to #52

Console shows (super long error message):

Error: Parse error at token: SELECT at line 2 column 147
Unexpected RESERVED_SELECT token: {"type":"RESERVED_SELECT","raw":"SELECT","text":"SELECT","start":200}. Instead, I was expecting to see one of the following:

A "]" based on:
...

To Reproduce

I cant access the conversation so I cant tell exacly what I did, if it helps, the DB ID is qqeztktg6u9hu8oe

Expected behavior

Application is accessable, loading previous conversation works and doesnt crash the deploy.

Screenshots

System information

  • OS: macOS
  • Browser (if applies): Brave Version 1.68.141 Chromium: 127.0.6533.120 (Officiell version) (arm64)
  • Version of supabase-js: -
  • Version of Node.js: -

Additional context

I can provide full console log if it helps, its super long. I also managed to download the database from the UI.

@beejaz beejaz added the bug Something isn't working label Aug 30, 2024
@gregnr
Copy link
Collaborator

gregnr commented Oct 30, 2024

Thanks for reporting @beejaz and apologies for the delay. It looks like that error is related to the SQL parser we are using. The fact that this is crashing the entire site is definitely not good. Let me investigate the error handling behind this first, then hopefully we will be able to retrieve the original queries you ran to identify what went wrong.

@gregnr
Copy link
Collaborator

gregnr commented Oct 30, 2024

Turns out this was caused by our SQL formatter failing to parse SQL correctly and throwing an error during component rendering. Fixed in #120 and merged into prod.

@beejaz would you mind confirming this fixed your page crashes?

@beejaz
Copy link
Author

beejaz commented Oct 31, 2024

Hi @gregnr appreciate you taking time to look into this. I've had issues accessing postgres.new from my home, but I managed it today and noticed its being migrated to database.build.

I did an export from old site and imported to new site. After import, i tried visiting my first available database which was https://database.build/db/0taevgl1r2h50y0m and got the same error for https://database.build/db/0taevgl1r2h50y0m :

Application error: a client-side exception has occurred (see the browser console for more information).

Console saying:


g.k.send @ base.js:7992
kga @ base.js:828
oj.send @ base.js:8004
g.k.flush @ base.js:7933
Th.flush @ base.js:7941
g.k.ID @ base.js:7981
(anonymous) @ base.js:851
sga @ base.js:848
wj.YI @ base.js:8030
(anonymous) @ base.js:8031
$k @ ooWaPVvljlU:1
kk @ ooWaPVvljlU:1
lS @ ooWaPVvljlU:1
rh @ VM1791:1
z.uv @ ooWaPVvljlU:1
u.f7 @ ooWaPVvljlU:1
(anonymous) @ base.js:8031
(anonymous) @ base.js:8031
Promise.then
Cj.snapshot @ base.js:8031
(anonymous) @ base.js:1042
Ca @ base.js:156
next @ base.js:157
b @ base.js:162
Promise.then
f @ base.js:164
Promise.then
f @ base.js:164
Promise.then
f @ base.js:164
(anonymous) @ base.js:165
xaa @ base.js:164
g.I @ base.js:166
Sha @ base.js:1040
(anonymous) @ base.js:1047
Ca @ base.js:156
next @ base.js:157
(anonymous) @ base.js:165
xaa @ base.js:164
g.I @ base.js:166
Tha @ base.js:1047
g.k.start @ base.js:8167
TX @ base.js:6224
(anonymous) @ base.js:6211
pt @ base.js:1841
g.qt @ base.js:1836
(anonymous) @ base.js:6211
g.k.publish @ base.js:8443
VR.publish @ base.js:10312
g.k.publish @ base.js:10307
g.P_ @ base.js:7066
g.P_.create @ base.js:12695
Jy.a.H @ www-embed-player.js:1895
Jy @ www-embed-player.js:1896
p.loadNewVideoConfig @ www-embed-player.js:1890
(anonymous) @ www-embed-player.js:1888
setTimeout
Gy @ www-embed-player.js:1888
$y @ www-embed-player.js:1928
(anonymous) @ www-embed-player.js:1940
(anonymous) @ ooWaPVvljlU:10
286-71d2c5d7ecdcdf1c.js:1 TypeError: n.map is not a function
    at xe (9026-8a94622da5ed42eb.js:1:13903)

I get this error for every previous database I try to load (the imported ones). Including https://database.build/db/qqeztktg6u9hu8oe

Hit me up if you need me to troubleshoot more.

PS. creating a new basic database task and accessing it works. https://database.build/db/0w24ugr31o74tou8

@gregnr
Copy link
Collaborator

gregnr commented Nov 5, 2024

Thanks for the details @beejaz. Can you confirm whether or not this same DB works on the old postgres.new domain, or does it crash there too with the n.map is not a function error? I'm trying to narrow down whether or not this is an export/import issue, or something else.

If it works on postgres.new, can you share the migrations (via Migrations tab) for that DB?

@beejaz
Copy link
Author

beejaz commented Nov 5, 2024

@gregnr Hey! Sorry, I wasnt aware that it was possible to access the old postgres.new now, I thought I was forced to export.

It DOES work with https://postgres.new/db/qqeztktg6u9hu8oe on the old domain now.

Here is the migrations from that one:

-- Migrations will appear here as you chat with AI

create table users (
  id bigint primary key generated always as identity,
  username text not null unique,
  email text not null unique,
  password_hash text not null
);

create table restaurants (
  id bigint primary key generated always as identity,
  name text not null
);

create table locations (
  id bigint primary key generated always as identity,
  restaurant_id bigint not null references restaurants (id),
  address text not null,
  postal_code text not null,
  postal_town text not null,
  country text not null,
  latitude double precision not null,
  longitude double precision not null
);

create table menus (
  id bigint primary key generated always as identity,
  location_id bigint not null references locations (id),
  week_start_date date not null,
  week_end_date date not null
);

create table dishes (
  id bigint primary key generated always as identity,
  menu_id bigint not null references menus (id),
  day_of_week int not null check (day_of_week between 1 and 7),
  name text not null,
  description text,
  ingredients_embedding vector (384)
);

create table ratings (
  id bigint primary key generated always as identity,
  user_id bigint not null references users (id),
  dish_id bigint not null references dishes (id),
  rating int not null check (rating between 1 and 5),
  created_at timestamp with time zone default now()
);

create view dish_average_ratings as
select
  dish_id,
  avg(rating) as average_rating
from
  ratings
group by
  dish_id;

This is the previous task I gave it that caused the crash:

Please generate accurate data for all current dishes in the database and insert the ingrediens embeddings into the db

Executed SQL:

select
  id,
  description
from
  dishes;

Generated embeddings:

Results stored in meta.embeddings table:

id: 3

content: Classic Italian pasta with rich meat sauce

id: 4

content: Fresh greens with grilled chicken and vinaigrette

id: 5

content: Spicy beef tacos with salsa and cheese

id: 6

content: Mixed vegetables stir-fried with soy sauce

id: 7

content: Crispy fried fish with potato chips

id: 8

content: Classic pizza with tomato, mozzarella, and basil

id: 9

content: Slow-roasted beef with gravy and vegetables

id: 10

content: Classic Italian pasta with rich meat sauce

id: 11

content: Fresh greens with grilled chicken and vinaigrette

id: 12

content: Spicy beef tacos with salsa and cheese

id: 13

content: Mixed vegetables stir-fried with soy sauce

id: 14

content: Crispy fried fish with potato chips

id: 15

content: Classic pizza with tomato, mozzarella, and basil

id: 16

content: Slow-roasted beef with gravy and vegetables

id: 17

content: Classic Italian pasta with rich meat sauce

id: 18

content: Fresh greens with grilled chicken and vinaigrette

id: 19

content: Spicy beef tacos with salsa and cheese

id: 20

content: Mixed vegetables stir-fried with soy sauce

id: 21

content: Crispy fried fish with potato chips

id: 22

content: Classic pizza with tomato, mozzarella, and basil

id: 23

content: Slow-roasted beef with gravy and vegetables

id: 24

content: Classic Italian pasta with rich meat sauce

id: 25

content: Fresh greens with grilled chicken and vinaigrette

id: 26

content: Spicy beef tacos with salsa and cheese

id: 27

content: Mixed vegetables stir-fried with soy sauce

id: 28

content: Crispy fried fish with potato chips

id: 29

content: Classic pizza with tomato, mozzarella, and basil

id: 30

content: Slow-roasted beef with gravy and vegetables

id: 31

content: Classic Italian pasta with rich meat sauce

id: 32

content: Fresh greens with grilled chicken and vinaigrette

id: 33

content: Spicy beef tacos with salsa and cheese

id: 34

content: Mixed vegetables stir-fried with soy sauce

id: 35

content: Crispy fried fish with potato chips

id: 36

content: Classic pizza with tomato, mozzarella, and basil

id: 37

content: Slow-roasted beef with gravy and vegetables

Error executing SQL:

UPDATE dishes SET ingredients_embedding = e.embedding
FROM (SELECT unnest(array[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]) AS id, unnest(array[SELECT embedding FROM meta.embeddings WHERE id IN (3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37)]) AS embedding) AS e
WHERE dishes.id = e.id;
syntax error at or near "SELECT"

@gregnr
Copy link
Collaborator

gregnr commented Nov 5, 2024

Amazing, thanks! Yes postgres.new will be available for a short period, but soon folks will be redirected to database.build.

Good news - I think I've identified the issue 😄 it's related to a bug when importing DBs into database.build.

I have a fix in place in #127. If you don't mind, would mind testing your imports on this preview branch to see if it solves it for you? If so we'll merge that to prod:

Import URL

https://postgres-new-git-fix-message-import-supabase.vercel.app/import

Main URL

https://postgres-new-git-fix-message-import-supabase.vercel.app

@gregnr
Copy link
Collaborator

gregnr commented Nov 5, 2024

I tested this using a DB export provided from another report who experienced the same issue, and all works correctly now. We'll merge this to prod now, but do let me know if you still experience errors!

@gregnr gregnr closed this as completed Nov 5, 2024
@beejaz
Copy link
Author

beejaz commented Nov 6, 2024

@gregnr The database import works on that staging branch 👌 Sorry for late reply, hopefully I didnt block anything.

Thank you for your help, awesome product and great work to you and the team!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants