"No query parameters in this request" in a parameterless query

Ok I don't know if I am being gaslit by my server or not at this point...

I am trying to use a Stored Procedure:
DECLARE
new_uuid uuid;
new_name text;
BEGIN
-- Generate a unique username with prefix 'Survivalist' and a random suffix
new_name := LEFT('Survivalist' || to_char(floor(random() * 1000), 'FM000'), 20); -- Adjust length as needed

-- Insert into user_Details, get the UUID
INSERT INTO public."user_Details"(email)
VALUES ('')
RETURNING "userID" INTO new_uuid;

-- Insert into user_Accounts
INSERT INTO public."user_Accounts"("userID", "AccountID", "name", "server")
VALUES (new_uuid, 1, new_name, 1);

-- Return the new UUID
RETURN new_uuid;
END;

The code I am using to trigger this procedure is C# (Unity):
string url = $"{apiUrl}/rest/v1/rpc/create_newuser";

// Create JSON body
string jsonBody = "{}";

// Create UnityWebRequest
UnityWebRequest request = new UnityWebRequest(url, "POST");
byte[] bodyRaw = System.Text.Encoding.UTF8.GetBytes(jsonBody);
request.uploadHandler = new UploadHandlerRaw(bodyRaw);
request.downloadHandler = new DownloadHandlerBuffer();
request.SetRequestHeader("apikey", apiKey);
request.SetRequestHeader("Authorization", $"Bearer {apiKey}");
request.SetRequestHeader("Content-Type", "application/json");

Debug.Log("Request payload: " + jsonBody);

// Send request and wait for response
await request.SendWebRequestAsync();

However, this just keeps telling me 'no' and I have no idea why.
Can anyone help before I throw my PC out the window?

For confirmation, I have enabled anon for both tables, to insert and update data. I have tested the procedure on the server and it works fine. The issue seems to be something to do with the byte[].
I am using Unity, so this is in C#.

Once I have this sorted out, I do plan to have the server ID added. so the jsonBody is required.
Was this page helpful?