0

when I try to submit image from fetch I receive

Blockquote PayloadTooLargeError: request entity too large at readStream (C:\Users\kilesss\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\dev-server\node_modules\raw-body\index.js:155:17) at getRawBody (C:\Users\kilesss\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\dev-server\node_modules\raw-body\index.js:108:12) at read (C:\Users\kilesss\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\kilesss\AppData\Roaming\npm\node_modules\expo-cli\node_modules@expo\dev-server\node_modules\body-parser\lib\types\json.js:135:5) at call (C:\Users\kilesss\AppData\Roaming\npm\node_modules\expo-cli\node_modules\connect\index.js:239:7) at next (C:\Users\kilesss\AppData\Roaming\npm\node_modules\expo-cli\node_modules\connect\index.js:183:5) at serveStatic (C:\Users\kilesss\AppData\Roaming\npm\node_modules\expo-cli\node_modules\serve-static\index.js:75:16) at call (C:\Users\kilesss\AppData\Roaming\npm\node_modules\expo-cli\node_modules\connect\index.js:239:7) at next (C:\Users\kilesss\AppData\Roaming\npm\node_modules\expo-cli\node_modules\connect\index.js:183:5) at call (C:\Users\kilesss\AppData\Roaming\npm\node_modules\expo-cli\node_modules\connect\index.js:248:3) Blockquote

I use fetch to send request

await fetch('http://167.172.110.234/api/createProducts', {
  method: 'POST',
  body: JSON.stringify({
    id: this.state.typeid,
    name: this.state.newProdTitle,
    unitId: this.state.unitID,
    typeId: this.state.typesID,
    photo:this.state.image64
  }),
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json",
    //Header Defination
    'Authorization': 'Bearer ' + DEMO_TOKEN
  },
}).then(
  async response => {

image64 is actually base64_encoded image

      const base64 = await FileSystem.readAsStringAsync(manipResult.uri, { encoding: 'base64' });

How I can increase submit limit ?

  • 1
    Does this answer your question? [Error: request entity too large](https://stackoverflow.com/questions/19917401/error-request-entity-too-large) – Lucio Feb 06 '21 at 18:52

0 Answers0