Version 1.11.0 of Medusa reverts changes related to Typeorm and the underlying mechanism for querying relations on entities.
Typeorm query strategy
In v1.10.0 of the Medusa core package, the mechanism for loading relations in Typeorm was changed from
query, which meant that instead of firing one large query with joins, separate queries for each requested relation are fired. This was added to improve performance and eliminate an issue with heavy memory usage. Read more about it in the release notes of 1.10.0.
query strategy came with unexpected issues related to database connection management. It turned out, the
query strategy obtains a new database connection for each separate query – instead of reusing the already established connection – leading to a drained connection pool and eventually unresponsive applications.
To eliminate these issues, it has been decided to ditch the query strategy. Instead, custom query strategies are introduced for Carts, Products, and Orders to maintain highly performant APIs while mitigating risk of unexpected memory and/or database connection problems.
Additionally, the core no longer relies on our Typeorm fork, because the fix related to the query strategy is now irrelevant. You should update your project to use the official Typeorm package
How to Update
Run the following command in the root directory of your Medusa Backend to update the core:
It's also recommended to update any other Medusa plugins or packages you have installed.
Change Typeorm Package
To make sure your project works as expected, you should move back to the official Typeorm package.
package.json, you should use the following Typeorm version: