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
Incorrect 413 Request Entity Too Large
on pg statement_too_complex
#3255
Comments
Treating all 54xxx error codes as 413 seemed to be wrong. Why would treating all those as 500 instead be better? The docs say this:
Especially the last two look like they could be mapped to 4xx instead. Maybe we should investigate more to find out how to raise those errors. In general, it might also be possible to look at the context of the raised error to determine whether the error occurred as part of our calling query or as part of some subprogram? Not sure about that. |
413 is totally misleading, some clients show it as
Not really. I've seen those happen when there's dynamic SQL and there's some infinite loop which generates too many columns. Those are always a server side error but not our fault. |
Another example of the same with functions: create function private.hi () returns text as $$ begin
return test.hi();
end; $$ language plpgsql;
create function hi () returns text as $$
select private.hi();
$$ language sql security definer; curl localhost:3000/rpc/hi -i
HTTP/1.1 413 Request Entity Too Large
{"code":"54001","details":null,"hint":"Increase the configuration parameter \"max_stack_depth\" (currently 2048kB), after ensuring the platform's stack depth limit is adequate.","message":
"stack depth limit exceeded"} 508 Loop Detected looks apt for these. |
Problem
Having an infinite loop on insert:
We reply with:
Which is incorrect. In general because a 4xx is a client side error.
This is done on:
postgrest/src/PostgREST/Error.hs
Line 479 in 1a141c1
Solution
Reply with a 500 status instead for every
54xxx
.It's tempting to turn
54xxx
into a 508 Loop Detected but maybe that's not correct for every case.The text was updated successfully, but these errors were encountered: