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

Supabase JS library delete does not give any response #535

Closed
2 tasks done
netcamo opened this issue May 7, 2024 · 1 comment
Closed
2 tasks done

Supabase JS library delete does not give any response #535

netcamo opened this issue May 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@netcamo
Copy link

netcamo commented May 7, 2024

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Hi!
I am using supabase js library. I was using delete function but it doesn't return any response while docs shows there should be a response (successful/unsuccessful).
The delete itself works but the problem is I have no way of knowing if any errors happened or it has proceeded successfully.

Reference: https://supabase.com/docs/reference/javascript/delete

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

 try {
    const supabase = createClient();

    const { data,error } = await supabase // At the Moment Supabase does not send error related to RLS  https://github.com/supabase/supabase-js/issues/902
      .from("<tableName>")
      .delete()
      .eq("id", id);
    console.log("data", data);
    console.log(error);
    if (error) {
      console.error("Error deleting :", error.message);
      throw error;
    } else {
      return;
    }
  } catch (error) {
    console.log("Error:", error);
    throw error;
  }

Both error and data are null in all cases (successful/unsuccessfull)

Expected behavior

I would expect it to give a proper response, at least same as the example in docs:
image

System information

  • OS: macOS
  • Version of supabase-js:
    "@supabase/ssr": "^0.3.0",
    "@supabase/supabase-js": "^2.43.1",
  • Version of Node.js: v21.7.1
@soedirgo
Copy link
Member

Hey @netcamo, the status and statusText comes from the whole response object, which you can get like so:

const { data, error, status, statusText } = await supabase
// ...

They don't come from data or error. We'll update the docs to make this clearer 👍

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