400 bad request

Im getting an 400 bad request error whilst trying to use supabase in my code index.js:1 GET https://wqwvralnrvdqpoemfbaw.supabase.co/rest/v1/contracts?select=contract_id&order=contract_id.desc&limit=1 400 (Bad Request) (anonymous) @ index.js:1 (anonymous) @ index.js:1 i @ index.js:1 Promise.then
u @ index.js:1 (anonymous) @ index.js:1 I @ index.js:1 (anonymous) @ index.js:1 then @ wrapper.mjs:1
No description
No description
34 Replies
Alexito
Alexito5w ago
You need to enable RLS to use supabase on the client
YesMan
YesManOP5w ago
ah, where do i enable that?
Alexito
Alexito5w ago
On the tables
YesMan
YesManOP5w ago
do i need to add any policies?
YesMan
YesManOP5w ago
im still getting the same error though after adding read, insert, delete and update access to all users in all 3
No description
garyaustin
garyaustin5w ago
Your error is not RLS. You don't have RLS enabled so no requests will be blocked.
YesMan
YesManOP5w ago
alright. what else could be causing this error then? could be the url perhapsm but since im working with html and js i cant use postgresql
garyaustin
garyaustin5w ago
Also RLS is a permission error or no data. Are you using supabase-js?
YesMan
YesManOP5w ago
should be yes
garyaustin
garyaustin5w ago
What is your supabase-js code that is doing this select? You should be logging out error with your request to see if there is more info. Also check the Dashboard API Gateway log and see if the request gets there and there is more error info.
Alexito
Alexito5w ago
you shared ur ip
YesMan
YesManOP5w ago
i mean if anyone wanna do anything with it sure i guess i could edit it out
garyaustin
garyaustin5w ago
I think it is saying your apikey is bad/wrong.
YesMan
YesManOP5w ago
this is the stuff related to creating Contracts
YesMan
YesManOP5w ago
this is the key to use?
No description
Alexito
Alexito5w ago
yea maybe read the doc
YesMan
YesManOP5w ago
asking doesnt mean i havent, i could read something, yet understand it wrong
garyaustin
garyaustin5w ago
What error do you get back ?
Alexito
Alexito5w ago
how did you write all that code if supabase did not work @YesMan
YesMan
YesManOP5w ago
copilot
Alexito
Alexito5w ago
oh ok
garyaustin
garyaustin5w ago
I may be wrong on the apikey I saw invalid in the log for apikey but it actually invalid:null so I guess that is valid... LOL It is getting the anon role it seems.
Alexito
Alexito5w ago
ye it is, supabase-js doesnt have cookie must use supabase/ssr
garyaustin
garyaustin5w ago
I don't see any reason in the log for the 400 or what it is about. If error from the js supabase call does not have anymore info sort of stuck at the moment. Is your instance status good on the main page?
No description
YesMan
YesManOP5w ago
i managed to fix the other error although now im getthing this errors spammed which is in short Could not fetch contracts. Check database permissions (RLS) and network connection.
YesMan
YesManOP5w ago
its just this 100 times a second Error fetching settings: {message: 'TypeError: Failed to fetch', details: 'TypeError: Failed to fetch at https://cd…r.net/npm/@supabase/supabase-js/+esm:7:3141)', hint: '', code: ''} index.html:1230 No debugger available, can not send 'variables'
garyaustin
garyaustin5w ago
You are in a loop Your code is.
YesMan
YesManOP5w ago
No description
garyaustin
garyaustin5w ago
Are you retrying if you get an error?
YesMan
YesManOP5w ago
its calculateClientData
Alexito
Alexito5w ago
just copy paste the example if the documentation and see it that works at least
YesMan
YesManOP5w ago
does seem to work now after fixing the save loop
No description
YesMan
YesManOP5w ago
it now only saves when need to aswell instead of like X ms xd im getting this though so will have to check on that Could not read source map for https://cdn.jsdelivr.net/npm/chart.js: Unexpected 404 response from https://cdn.jsdelivr.net/npm/chart.umd.min.js.map: Failed to resolve the requested file.

Did you find this page helpful?