PayloadTooLargeError: request entity too large

Hello, at some time recently I noticed our app start (Android) to do this when running via console process:

PayloadTooLargeError: request entity too large
    at readStream (C:\Users\karlk\AppData\Roaming\npm\node_modules\expo-cli\node_modules\raw-body\index.js:155:17)
    at getRawBody (C:\Users\karlk\AppData\Roaming\npm\node_modules\expo-cli\node_modules\raw-body\index.js:108:12)
    at read (C:\Users\karlk\AppData\Roaming\npm\node_modules\expo-cli\node_modules\body-parser\lib\read.js:77:3)
    at jsonParser (C:\Users\karlk\AppData\Roaming\npm\node_modules\expo-cli\node_modules\body-parser\lib\types\json.js:135:5)
    at Layer.handle [as handle_request] (C:\Users\karlk\AppData\Roaming\npm\node_modules\expo-cli\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (C:\Users\karlk\AppData\Roaming\npm\node_modules\expo-cli\node_modules\express\lib\router\index.js:317:13)
    at C:\Users\karlk\AppData\Roaming\npm\node_modules\expo-cli\node_modules\express\lib\router\index.js:284:7
    at Function.process_params (C:\Users\karlk\AppData\Roaming\npm\node_modules\expo-cli\node_modules\express\lib\router\index.js:335:12)
    at next (C:\Users\karlk\AppData\Roaming\npm\node_modules\expo-cli\node_modules\express\lib\router\index.js:275:10)
    at expressInit (C:\Users\karlk\AppData\Roaming\npm\node_modules\expo-cli\node_modules\express\lib\middleware\init.js:40:5)

Hard to tell where exactly the problem is, but it’s getting more frequent. Any ideas on what I can do to chase it down? Entry points into my code that this trace mentions don’t seem very helpful.
Can I configure the runtime server to increase this payload size, and/or should I?

thanks for any help on this.

Hey @karlkras,

Are you making any large queries with fetch in your app or does your project have a lot of assets involved?

Cheers,
Adam

Hi @adamjnav

I’m having same issue. I use fetch to upload images converted to base64 using FileSystem to cloudinary. It works but sometimes it throws the “PayloadTooLargeError: request entity too large” error

Please, how do I got about fixing this?

I have figured out the problem. I had to remove the console.logs. I think they were impacting the performance of the app

Hey I’m running into the same issue. I don’t have a console log issue but am trying to load very large files for my ML model. Any ideas on how we maybe set expo to allow larger images? I saw it might be some type of express server or node settings issue? javascript - PayloadTooLargeError: request entity too large - Stack Overflow

I’m Facing the same issue, in our case we are running Android App OK, but when trying to run EXACTLY THE SAME CODE AND APP with iPhone 6s (iOS) it fails before loading app with error:

PayloadTooLargeError: request entity too large

at readStream (C:\Users\---\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\node_modules\raw-body\index.js
:155:17)
    at getRawBody (C:\Users\---\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\node_modules\raw-body\index.js
:108:12)
    at read (C:\Users\---\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\node_modules\body-parser\lib\read.js
:77:3)
    at jsonParser (C:\Users\---\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\node_modules\body-parser\lib\t
ypes\json.js:135:5)

This is happening between Windows 10 and iOS 13.7, latest Expo/Expo CLI: ^41.0.0 / 4.5.2