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

calling .eq.update crashes it? i'm sorry, I don't really know if i did something wrong #41

Closed
ghost opened this issue May 29, 2022 · 9 comments

Comments

@ghost
Copy link

ghost commented May 29, 2022

So my code is

	var query_task := Supabase.database.query(SupabaseQuery.new().from("creators").eq("id", "13").update({
		"data": {"key2": "value2"},
	}))

This should update it, right? Anyway, it crashes the game on the database_task _on_task_completed function. Apparently result_body is set to an array instead of a dictionary? I don't know how that's possible.

@ghost
Copy link
Author

ghost commented May 30, 2022

Also, I tried calling sign_in_anonymous() but i just got the error "invalid_request >> refresh token required"

@fenix-hub
Copy link
Collaborator

So my code is

	var query_task := Supabase.database.query(SupabaseQuery.new().from("creators").eq("id", "13").update({
		"data": {"key2": "value2"},
	}))

This should update it, right? Anyway, it crashes the game on the database_task _on_task_completed function. Apparently result_body is set to an array instead of a dictionary? I don't know how that's possible.

I can check that later, eventually the endpoint returns an Array if there are multiple rows updated instead of one. Maybe I'm mapping that wrongly

@fenix-hub
Copy link
Collaborator

Also, I tried calling sign_in_anonymous() but i just got the error "invalid_request >> refresh token required"

I think that anonymous login is not supported anymore, or "fixed" since it used the anonymous key but without identifying any user (which is not secure anyway).
You can try this workaround supabase/auth#68

@ghost
Copy link
Author

ghost commented May 30, 2022

okay, will do!

@ghost
Copy link
Author

ghost commented May 30, 2022

For the first issue, I didn't have permission to update the table since my policies were set incorrectly, so the returned array was empty. I have them set correctly now.

@ghost
Copy link
Author

ghost commented May 30, 2022

Now I can't upload images 😭 , the error is just empty

@ghost
Copy link
Author

ghost commented May 30, 2022

I am calling Supabase.storage.from("public").upload("thumbnails/test.png", "user://icon.png") and it doesn't work 😭

@fenix-hub
Copy link
Collaborator

fenix-hub commented May 31, 2022

@ShatReal the error could be empty because you didn't authenticate before uploading a file
Make sure to have such flow

    var task:AuthTask= yield(Supabase.auth.sign_in(user_mail, user_pwd), "completed")
    var upload : StorageTask = yield(Supabase.storage.from("games").upload("icon.png", "res://icon.png"), "completed")

or use signals

@fenix-hub
Copy link
Collaborator

About the empty error: that's an issue coming from supabase backend, sadly :
I'll reach out to Supabase devs to ask for a meaningful error

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

1 participant