-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: large dataset error - Maximum call stack size exceeded #10504
Comments
This is my backend url https://secretgreen-au-backend-server.g5edov.easypanel.host/ I can not get products list even 10 products, fetching 10 products using offset now gives the error: curl -X GET "https://secretgreen-au-backend-server.g5edov.easypanel.host/store/products?limit=1&offset=10" I have 130,000 products and growing. |
@chillpilllike do you have a dump or seed you can share that can help me reproduce this? riqwan[at]medusajs.com |
I have shared the database backup file. Thank you! |
Hi, I’m also getting the same error and feeling stuck. I’ve tried a couple of things, but nothing has worked so far. Are you able to resolve this out? |
@algorithm-diva, can you share more about your machine(s) and store volume, e.g. number of product? |
Our setup is running on a company’s provided AWS instance equipped with 36 vCPUs and 96 GB RAM. Here’s what we observed regarding store volume:
|
@algorithm-diva if you do a curl on the |
@riqwan The curl command works perfectly fine with the database containing 80k products, returning the product list as expected. However, when I run the same curl command on a database with 160k products, it fails with the following response: {"code":"unknown_error","type":"unknown_error","message":"An unknown error occurred."} The backend logs show the same recurring error: “Maximum call stack size exceeded.” This indicates that the issue occurs specifically when dealing with the larger dataset of 160k products. |
@riqwan were you able to reproduce the error using the dump file i provided? |
hello team, any solution other than his problem? |
Hey, unfortunately there isn't a solution for this at this current moment. Medusa v2 introduces a new modular architecture with a strict domain separation at the database level. This brings significant improvements and future enablements, but also introduces (temporary) limitations. One known limitation is the size of product catalogs. Our cross-module filtering tooling isn’t yet optimized for the fully modular architecture, and stores with very large catalog sizes may encounter issues with database queries becoming too large, as highlighted in this GitHub issue. We are committed to removing this limitation within the next 3-4 months. In in the meantime, we recommend integrating a search engine like Meilisearch as a store-facing query layer for large catalogs. We will provide updates as we make progress. Thank you for your patience and for raising these issues. |
Oh, I’m feeling a bit disappointed. Medusa was truly my top choice among other platforms. :( I’ll check back in the future when Medusa has matured further. Thank you! |
@chillpilllike, I'd love to learn more about your use case, if you don't mind sharing. As @riqwan alluded to, there are several workarounds now, that might apply to you. Feel free to send me an email at oli[at]medusajs.com, if this is of interest. |
Package.json file
Node.js version
20
Database and its version
16
Operating system name and version
22.04
Browser name
safari
What happended?
When I try to open storefront, it gives error 500 and backend give the below error:
[14:58:13.000] ERROR:
message: "Maximum call stack size exceeded"
stack: [
{
"columnNumber": 16,
"fileName": "/app/.medusa/server/node_modules/@mikro-orm/core/platforms/ExceptionConverter.js",
"functionName": "PostgreSqlExceptionConverter.convertException",
"lineNumber": 8,
"methodName": "convertException",
"native": false,
"typeName": "PostgreSqlExceptionConverter"
},
{
"columnNumber": 22,
"fileName": "/app/.medusa/server/node_modules/@mikro-orm/postgresql/PostgreSqlExceptionConverter.js",
"functionName": "PostgreSqlExceptionConverter.convertException",
"lineNumber": 42,
"methodName": "convertException",
"native": false,
"typeName": "PostgreSqlExceptionConverter"
},
{
"columnNumber": 54,
"fileName": "/app/.medusa/server/node_modules/@mikro-orm/core/drivers/DatabaseDriver.js",
"functionName": "PostgreSqlDriver.convertException",
"lineNumber": 201,
"methodName": "convertException",
"native": false,
"typeName": "PostgreSqlDriver"
},
{
"columnNumber": 24,
"fileName": "/app/.medusa/server/node_modules/@mikro-orm/core/drivers/DatabaseDriver.js",
"functionName": null,
"lineNumber": 205,
"methodName": null,
"native": false,
"typeName": null
},
{
"columnNumber": 5,
"fileName": "node:internal/process/task_queues",
"functionName": "processTicksAndRejections",
"lineNumber": 95,
"methodName": null,
"native": false,
"typeName": null
},
{
"columnNumber": 31,
"fileName": "/app/.medusa/server/node_modules/knex/lib/formatter/wrappingFormatter.js",
"functionName": "unwrapRaw",
"lineNumber": 104,
"methodName": null,
"native": false,
"typeName": null
},
{
"columnNumber": 15,
"fileName": "/app/.medusa/server/node_modules/knex/lib/formatter/wrappingFormatter.js",
"functionName": "wrap",
"lineNumber": 80,
"methodName": null,
"native": false,
"typeName": null
},
{
"columnNumber": 11,
"fileName": "/app/.medusa/server/node_modules/knex/lib/query/querycompiler.js",
"functionName": "QueryCompiler_PG.get tableName [as tableName]",
"lineNumber": 1472,
"methodName": "get tableName [as tableName]",
"native": false,
"typeName": "QueryCompiler_PG"
},
{
"columnNumber": 13,
"fileName": "/app/.medusa/server/node_modules/knex/lib/query/querycompiler.js",
"functionName": "QueryCompiler_PG.onlyJson",
"lineNumber": 800,
"methodName": "onlyJson",
"native": false,
"typeName": "QueryCompiler_PG"
},
{
"columnNumber": 25,
"fileName": "/app/.medusa/server/node_modules/knex/lib/query/querycompiler.js",
"functionName": "QueryCompiler_PG.columns",
"lineNumber": 313,
"methodName": "columns",
"native": false,
"typeName": "QueryCompiler_PG"
},
{
"columnNumber": 40,
"fileName": "/app/.medusa/server/node_modules/knex/lib/query/querycompiler.js",
"functionName": null,
"lineNumber": 135,
"methodName": null,
"native": false,
"typeName": null
},
{
"columnNumber": null,
"fileName": null,
"functionName": "Array.forEach",
"lineNumber": null,
"methodName": "forEach",
"native": false,
"typeName": "Array"
},
{
"columnNumber": 16,
"fileName": "/app/.medusa/server/node_modules/knex/lib/query/querycompiler.js",
"functionName": "QueryCompiler_PG.select",
"lineNumber": 134,
"methodName": "select",
"native": false,
"typeName": "QueryCompiler_PG"
},
{
"columnNumber": 29,
"fileName": "/app/.medusa/server/node_modules/knex/lib/query/querycompiler.js",
"functionName": "QueryCompiler_PG.toSQL",
"lineNumber": 75,
"methodName": "toSQL",
"native": false,
"typeName": "QueryCompiler_PG"
},
{
"columnNumber": 41,
"fileName": "/app/.medusa/server/node_modules/knex/lib/formatter/wrappingFormatter.js",
"functionName": "unwrapRaw",
"lineNumber": 102,
"methodName": null,
"native": false,
"typeName": null
}
]
[14:58:13.000] USERLVL:
message: "172.18.0.1 - - [08/Dec/2024:14:58:13 +0000] "GET /store/products?limit=1&offset=999999®ion_id=reg_01JEE2P8Z6ESDR4XZPEHWNTDEB HTTP/1.1" 500 86 "-" "undici""
Expected behavior
Products should be fetched without errors using api
Actual behavior
{"code":"unknown_error","type":"unknown_error","message":"An unknown error occurred."}%
Link to reproduction repo
https://github.com/medusajs/medusa.git
The text was updated successfully, but these errors were encountered: