Error:stream is not readable. when I try to config upload plugin

After I config my middleware just Iike the documentation says:

Then I got this error:

InternalServerError: stream is not readable
    at readStream (D:\source\javascript\tuo-cms\node_modules\raw-body\index.js:185:17)
    at executor (D:\source\javascript\tuo-cms\node_modules\raw-body\index.js:120:5)
    at new Promise (<anonymous>)
    at getRawBody (D:\source\javascript\tuo-cms\node_modules\raw-body\index.js:119:10)
    at D:\source\javascript\tuo-cms\node_modules\co-body\lib\json.js:41:14
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async D:\source\javascript\tuo-cms\node_modules\@strapi\strapi\lib\middlewares\body.js:42:9
    at async D:\source\javascript\tuo-cms\node_modules\@strapi\strapi\lib\middlewares\body.js:58:9
    at async D:\source\javascript\tuo-cms\node_modules\@strapi\strapi\lib\middlewares\logger.js:9:5
    at async D:\source\javascript\tuo-cms\node_modules\@strapi\strapi\lib\middlewares\powered-by.js:16:5

strapi version: 4.14.0-alpha.0

1 Like

I have the same issue when setting the upload config from the Strapi Tutorial.
Using Strapi v4.15.5.

1 Like

I’m trying to reproduce it and I don’t have the error :

I’m using this image to upload

configuration :

Environment: development
OS: linux-x64
Strapi Version: 4.16.2
Node/Yarn Version: yarn/1.22.19 npm/? node/v18.19.0 linux x64
Edition: Community
Database: sqlite

In my case, problem was that I copy-pasted example and left “strapi::body” in array that is included as default.

Which led middleware to be execute twice, I guess?

Anyway, hope this helps anyone.

1 Like

Well spotted, that helped me to fix it in my case!