chore(): Default caching configuration and gracefull redis error handling (#13663)

* chore(): Default caching configuration and gracefull redis error handling

* Create odd-moons-crash.md

* chore(): Default caching configuration and gracefull redis error handling

* fixes

* address feedback

* revert(): Test utils imit module fix

* reconnect

* reconnect

* reconnect
This commit is contained in:
Adrien de Peretti
2025-10-06 17:57:11 +02:00
committed by GitHub
parent 28d57b7bf8
commit 51859c38a7
9 changed files with 565 additions and 328 deletions
@@ -1048,6 +1048,7 @@ describe("defineConfig", function () {
process.env.EXECUTION_CONTEXT = "medusa-cloud"
process.env.REDIS_URL = "redis://localhost:6379"
process.env.CACHE_REDIS_URL = "redis://localhost:6379"
process.env.S3_FILE_URL = "https://s3.amazonaws.com/medusa-cloud-test"
process.env.S3_PREFIX = "test"
process.env.S3_REGION = "us-east-1"
@@ -1086,6 +1087,21 @@ describe("defineConfig", function () {
},
"resolve": "@medusajs/medusa/cache-redis",
},
"caching": {
"options": {
"providers": [
{
"id": "caching-redis",
"is_default": true,
"options": {
"redisUrl": "redis://localhost:6379",
},
"resolve": "@medusajs/medusa/caching-redis",
},
],
},
"resolve": "@medusajs/caching",
},
"cart": {
"resolve": "@medusajs/medusa/cart",
},
@@ -1255,6 +1271,7 @@ describe("defineConfig", function () {
process.env.EXECUTION_CONTEXT = "medusa-cloud"
process.env.REDIS_URL = "redis://localhost:6379"
process.env.CACHE_REDIS_URL = "redis://localhost:6379"
process.env.S3_FILE_URL = "https://s3.amazonaws.com/medusa-cloud-test"
process.env.S3_PREFIX = "test"
process.env.S3_REGION = "us-east-1"
@@ -1294,6 +1311,21 @@ describe("defineConfig", function () {
},
"resolve": "@medusajs/medusa/cache-redis",
},
"caching": {
"options": {
"providers": [
{
"id": "caching-redis",
"is_default": true,
"options": {
"redisUrl": "redis://localhost:6379",
},
"resolve": "@medusajs/medusa/caching-redis",
},
],
},
"resolve": "@medusajs/caching",
},
"cart": {
"resolve": "@medusajs/medusa/cart",
},
@@ -1473,6 +1505,7 @@ describe("defineConfig", function () {
process.env.EXECUTION_CONTEXT = "medusa-cloud"
process.env.REDIS_URL = "redis://localhost:6379"
process.env.CACHE_REDIS_URL = "redis://localhost:6379"
process.env.S3_FILE_URL = "https://s3.amazonaws.com/medusa-cloud-test"
process.env.S3_PREFIX = "test"
process.env.S3_REGION = "us-east-1"
@@ -1518,6 +1551,21 @@ describe("defineConfig", function () {
},
"resolve": "@medusajs/medusa/cache-redis",
},
"caching": {
"options": {
"providers": [
{
"id": "caching-redis",
"is_default": true,
"options": {
"redisUrl": "redis://localhost:6379",
},
"resolve": "@medusajs/medusa/caching-redis",
},
],
},
"resolve": "@medusajs/caching",
},
"cart": {
"resolve": "@medusajs/medusa/cart",
},
@@ -303,6 +303,24 @@ function resolveModules(
},
]
if (process.env.CACHE_REDIS_URL) {
cloudModules.push({
resolve: MODULE_PACKAGE_NAMES[Modules.CACHING],
options: {
providers: [
{
id: "caching-redis",
resolve: "@medusajs/medusa/caching-redis",
is_default: true,
options: {
redisUrl: process.env.CACHE_REDIS_URL,
},
},
],
},
})
}
/**
* The default set of modules to always use. The end user can swap
* the modules by providing an alternate implementation via their