reflex icon indicating copy to clipboard operation
reflex copied to clipboard

rx.upload error handling

Open benedikt-bartscher opened this issue 1 year ago β€’ 2 comments

Nginx with default config returns 413 and an error page if the payload is too big:

<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx</center>
</body>
</html>

Reflex frontend exception handler shows this:

SyntaxError: JSON5: invalid character '<' at 1:1
    at ev (https://testing.com/_next/static/chunks/pages/_app-461f214d5ad5a26a.js:1:49927)
    at eh (https://testing.com/_next/static/chunks/pages/_app-461f214d5ad5a26a.js:1:49316)
    at Object.value (https://testing.com/_next/static/chunks/pages/_app-461f214d5ad5a26a.js:1:43558)
    at er (https://testing.com/_next/static/chunks/pages/_app-461f214d5ad5a26a.js:1:41963)
    at Object.parse (https://testing.com/_next/static/chunks/pages/_app-461f214d5ad5a26a.js:1:50081)
    at https://testing.com/_next/static/chunks/pages/_app-461f214d5ad5a26a.js:19:46786
    at https://testing.com/_next/static/chunks/pages/_app-461f214d5ad5a26a.js:19:47241
    at Array.map (<anonymous>)
    at https://testing.com/_next/static/chunks/pages/_app-461f214d5ad5a26a.js:19:47233
    at Array....

Maybe we should check for the response code instead of directly parsing the input. And raise a more readable error for the frontend exception handler.

benedikt-bartscher avatar Nov 28 '24 19:11 benedikt-bartscher

Can I work on this, plz assign it to me.

Rustix1604 avatar Dec 12 '24 07:12 Rustix1604