medusa
medusa copied to clipboard
MedusaJS Error: 'InternalServerError: stream is not readable' When Deleting Test Product
Bug report
Describe the bug
When attempting to delete a test product in MedusaJS, an InternalServerError
occurs, indicating a problem with stream readability. This issue arises in the context of handling a request in the Medusa environment, specifically related to stream handling in the raw-body
module, as part of the request processing pipeline.
System information
- Medusa version (including plugins):
- @medusajs/link-modules: ^0.2.3
- @medusajs/medusa-js: ^6.1.4
- @medusajs/modules-sdk: ^1.12.3
- @medusajs/pricing: ^0.1.4
- @medusajs/product: ^0.3.4
- @medusajs/ui: ^2.2.0
- @medusajs/client-types: ^0.2.2
- @medusajs/medusa: ^1.18.0
- @medusajs/ui-preset: ^1.0.2
- Node.js version: v20.9.0
- Database: postgres (PostgreSQL) 15.5 (Homebrew)
- Operating system: Darwin Romans-MBP 23.1.0 Darwin Kernel Version 23.1.0; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 arm64
- Browser: Google Chrome 120.0.6099.109
Steps to reproduce the behavior
- Create a new product in MedusaJS with specific attributes (as detailed in the provided product object information).
- Attempt to delete the created test product.
- Wait (so long)
- Encounter the
InternalServerError: stream is not readable
error during the deletion process. - The error stack trace is provided for reference.
Expected behavior
The expected behavior is the successful deletion of the test product without encountering any internal server errors. The process should complete smoothly, reflecting changes in the database and user interface accordingly.
Code snippets
- Error Message:
InternalServerError: stream is not readable
- Relevant Code Segment:
at readStream (/Users/dutchakdev/Dev/monorepo/medusa/node_modules/raw-body/index.js:185:17) at getRawBody (/Users/dutchakdev/Dev/monorepo/medusa/node_modules/raw-body/index.js:116:12)
- Full error:
InternalServerError: stream is not readable
at readStream (/Users/dutchakdev/Dev/monorepo/medusa/node_modules/raw-body/index.js:185:17)
at getRawBody (/Users/dutchakdev/Dev/monorepo/medusa/node_modules/raw-body/index.js:116:12)
at read (/Users/dutchakdev/Dev/monorepo/medusa/node_modules/body-parser/lib/read.js:79:3)
at jsonParser (/Users/dutchakdev/Dev/monorepo/medusa/node_modules/body-parser/lib/types/json.js:138:5)
at Layer.handle [as handle_request] (/Users/dutchakdev/Dev/monorepo/medusa/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/dutchakdev/Dev/monorepo/medusa/node_modules/express/lib/router/index.js:328:13)
at /Users/dutchakdev/Dev/monorepo/medusa/node_modules/express/lib/router/index.js:286:9
at Function.process_params (/Users/dutchakdev/Dev/monorepo/medusa/node_modules/express/lib/router/index.js:346:12)
at next (/Users/dutchakdev/Dev/monorepo/medusa/node_modules/express/lib/router/index.js:280:10)
at /Users/dutchakdev/Dev/monorepo/medusa/node_modules/@medusajs/medusa/dist/loaders/api.js:58:17
Additional context
This issue seems to be related to the handling of streams within the MedusaJS framework, possibly linked to the way the body-parser library processes incoming requests. Further investigation into the handling of stream data in this specific context is needed.
+1
+1
Same here on medusa 1.20.3