Is anybody aware that `RPC parameters` (calling RP...
# help
n
Is anybody aware that
RPC parameters
(calling RPC from the
supabase-js
client) are sorted by name (alphabetically) before calling the database function? Is this a feature or something that can be disabled? or am I forced to sort my RPC's params in that way?
n
Hello @NARCISO! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
🆕 RPC Parameters are sorted before calling the DB function?
s
I'm not sure what you mean by sorted alphabetically. Can you expand on this please?
n
RPC Parameters are sorted before calling the DB function?
n
Hi @silentworks , I actually found out it's a HTTP POST thing. The
supabase-js
client sent a POST request with the following RAW body:
Copy code
{
  "sender_user_id": "3c6bc0b0-dad2-4e5d-a3e9-4c3a177d9442",
  "recipient_user_id": "034319ea-968d-4815-8a99-e7af2bc371c0",
  "content": "TEISTI JWAOID",
  "correlated_offer_id": null,
  "work_proposal_id": null
}
In the UI of the Network Tab inside Firefox, you can see (in the attached image) the parameters sorted in a different way.Sure it is just a browser thing to display the fields sorted, but it's actually strange because then I get the following error in response: "Could not find the
public.create_message(content, correlated_offer_id, recipient_user_id, sender_user_id, work_proposal_id)
function or the public.create_message function with a single unnamed json or jsonb parameter in the schema cache". The real function arguments:
Copy code
sender_user_id uuid,
    recipient_user_id uuid,
    maybe_conversation_id uuid,
    content text,
    correlated_offer_id uuid,
    work_proposal_id uuid
The problem is there where it seems that the request is sorting the arguments and therefore the RPC function is called with a wrong order of the params.
Any idea on this? Should I just sort my function params alphabetically? or this is a bug?
Solved. The request had a missing parameter. A null variable was being ignored in the object of the request.
n
Thread was archived by @NARCISO. Anyone can send a message to unarchive it.
m
got the same issue, my problem was i declared params in camelCase but you can't use them. Be careful nameVersion become nameversion