supabase: SQL Editor errors handling is broken

Describe the bug When entering some potentially failing SQL query into the Editor an entire page errors out with Next’s component showing Application error: a client-side exception has occurred (see the browser console for more information). message.

To Reproduce Steps to reproduce the behavior:

  1. Go to the SQL Editor.
  2. Enter a query that’s going to fail. For example, for me it was creating a view and selecting a column that doesn’t exist.
CREATE VIEW collection_page_artifacts AS
SELECT
	artifacts.*,
	collection_artifact.collection_id,
	collections.title,
	collections.user_id,
	collections.access,
        -- 'profiles' doesn't exist under 'collections', it's a separate table
	collections.profiles
FROM
	artifacts
INNER JOIN
	collection_artifact ON artifacts.id = collection_artifact.artifact_id
INNER JOIN
	collections ON collection_artifact.collection_id = collections.id
INNER JOIN
	profiles ON collections.user_id = profiles.id;

But I have this issue with literally every possible SQL query that’s incorrect, even if it’s just syntax error.

  1. Run the query.

Expected behavior

  • A query is run and the error is visible in the Results section.
  • If that failed, I’d expect to go to Logs/Postgres and see the error log there, but as you can see in the second screenshot, the error/warning message looks scattered and broken down into other events with the same time stamp.

Screenshots image image

Desktop (please complete the following information):

  • OS: macOS Sonoma 14.1.1
  • Browser: Arc (Chromium) / Safari
  • Version of CLI: 1.112.0

Additional context Worth mentioning that upon opening the SQL Editor page and entering some query, I have the “Failed to save” warning in the bottom right. image

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 9
  • Comments: 27 (8 by maintainers)

Most upvoted comments

Thanks all — investigating

@saltcod This error is not resolved.

I tested wrong statement like execute 'select 1' in studio at master branch now.

It will be show error syntax error at or near "'select 1'", but crashed now.

Hi all — this should be fixed with the latest update. Could you report back if it’s still not fixed for you?

Please try the beta version to see if the problem persists: npx supabase@beta start

@Stevbreu

Hey happy new year! Ive been experimenting with the 2024-01-01 version of studio and it works like a charm, but please note im still testing for things i use it for 😃 try using that for the docker-compose and get back with results

Hey @saltcod, updated to 1.115.4 via brew and unfortunately still seeing the same error when for example trying to SELECT * from a nonexistent table.

Failed to save message is still present too.

Hi, this error is not fixed with the last update. Sorry and we hope the this problem will fix soon 🙏🏻🫵

Hallo everyone, i’ve got the same error like the others and I have no idea what’s going wrong. Not every sql request shows an error. This statemant will execute sucessfully: select * from (select version()) as version, (select current_setting('server_version_num')) as version_number;

But this sql request went wrong: select * from auth

Bildschirmfoto 2023-11-27 um 19 53 12 Bildschirmfoto 2023-11-27 um 19 55 31

Thank’s and regards Steven

I’m getting the same thing. An SQL error causes a crash, and queries cannot save.

Since this issue is related to studio, you will be able to get quicker help from frontend repo.