supabase-js: After updating to Supabase-js 2.0, expected return type is genericStringError
Bug report
Describe the bug
When trying to run a select query with supabase-js 2.0, typescript throws an error that the data returned by the api call is a generic string error causing issues.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Here is the select function being ran:
const { data, error } = await supabase
.from("show")
.select(attributes)
.eq("slug", slug);
if (error) throw error;
return data;
Expected behavior
Not entirely sure what the return type should be, but I know it shouldn’t expect to return a genericStringError. The data does get returned but this genericStringError is causing problems
Screenshots
If applicable, add screenshots to help explain your problem.
System information
MacOS Supabase-js: 2.0
Additional context
Add any other context about the problem here.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 1
- Comments: 15 (2 by maintainers)
Should a new issue be opened for this? Having to use a hack isn’t really a good long term solution.
If this is not going to be fixed for some reason, I’d like to at least know why. But as it stands now, this is still an open issue…
Hi I have the same issue with the same setup as the OP, I keep seeing “GenericStringError” for the return and it errors out.
Doing
as anydidn’t work but doingcolumns as '*'seems to kill the error. Still very unwieldy as a hack.It’s now October 2024, more 2 years after this bug report was initially filed. Our dev team continues to encounter this issue.
Our company is paying for Supabase as a Service, so we would really appreciate an update on when we can expect a proper fix for this long standing bug. Thanks!
Hi having the same problem… Why was this closed? Not having type support unless we use string literals seems pretty limiting. Is this a typescript limitation which can’t be fixed or is it a problem with how it’s handled in the api?
This problem should not have been closed. like others, this is what worked for me:
.select(columns as "*")discovered this strange anomoly today:
Here’s how I implemented
Thank you very much for posting this solution; it’s the only way I was able to solve the problem since the other solutions, including
as anyalso did not work for dynamically passed select query strings. But I’d still consider this an issue in 2024, as ideally solving this wouldn’t require implementing a hack 🤷🏼♂️