strapi-plugin-rest-cache: Stuck can't start the plugin (see Image)

Hello, this is why every time I run npm run start or develop package it’s stuck here (see image) , if i changed it to memory it running well

image

package.json

"strapi-plugin-redis": "^1.0.1",

"strapi-plugin-rest-cache": "^4.2.7",

"strapi-provider-rest-cache-redis": "^4.2.7"

plugin.js

function getPlugins(env) {
  let redisConfig = {
    config: {
      connections: {
        default: {
          connection: {
            host: env("REDIS_CLUSTER_HOST_1"),
            name: "test",
            db: 0,
          },
          settings: {
            debug: Boolean(env("REDIS_CONNECTION_DEBUG")),
          },
        },
      },
    },
  };
  if (env("NODE_ENV") === "production") {
    // Create a Redis cluster client
    let redisClusterUrls = env("REDIS_CLUSTER_HOST_URLS")
      .split(",")
      .map((url) => {
        return {
          host: url,
          port: 6379,
        };
      });
    redisConfig = {
      config: {
        connections: {
          default: {
            connection: {
              nodes: redisClusterUrls,
              name: "test",
              db: 0,
            },
            settings: {
              debug: Boolean(env("REDIS_CONNECTION_DEBUG")),
            },
          },
        },
      },
    };
  }
  return {
    redis: redisConfig,
    "rest-cache": {
      config: {
        provider: {
          name: "redis",
          options: {
            max: 32767,
            connection: "default",
          },
        },
        strategy: {
          keyPrefix: "test",
          // if you are using keyPrefix for your Redis, please add <keysPrefix>
          contentTypes: [
            // list of Content-Types UID to cache
            "api::city.city",
            // "api::community.community",
            "api::competition.competition",
            "api::competition-type.competition-type",
            "api::division.division",
            // "api::match.match",
            "api::match-event.match-event",
            "api::match-lineup.match-lineup",
            "api::match-statistic.match-statistic",
            "api::player.player",
            "api::season.season",
            "api::sponsor.sponsor",
            // "api::stadium.stadium",
            // "api::team.team",
          ],
          debug: Boolean(env("REDIS_STRATEGY_DEBUG")),
          hitpass: false,
          enableXCacheHeaders: true,
        },
      },
    },
    ckeditor: {
      enabled: true,
      config: {
        editor: {
          mediaEmbed: {
            previewsInData: true,
          },
        },
      },
    },
    seo: {
      enabled: true,
    },
    sentry: {
      enabled: true,
      config: {
        // Only set `dsn` property in production
        dsn: env("NODE_ENV") === "production" ? env("SENTRY_DSN") : null,
      },
    },
  };
}
module.exports = ({ env }) => {
  let commonPlugins = getPlugins(env);
  if (env("NODE_ENV") !== "development") {
    commonPlugins = {
      ...commonPlugins,
      upload: {
        config: {
          provider: "aws-s3",
          providerOptions: {
            s3Options: {
              credentials: {
                accessKeyId: env("AWS_ACCESS_KEY_ID"),
                secretAccessKey: env("AWS_ACCESS_SECRET"),
              },
              region: env("AWS_REGION"),
              params: {
                Bucket: env("AWS_BUCKET_NAME"),
              },
            },
          },
          actionOptions: {
            upload: {},
            uploadStream: {},
            delete: {},
          },
        },
      },
    };
  }
  return commonPlugins;
};

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Reactions: 4
  • Comments: 27

Most upvoted comments

fix by remove ^ in package.json node version v18.18.2

    "strapi-plugin-redis": "1.0.1",
    "strapi-plugin-rest-cache": "4.2.8",
    "strapi-provider-rest-cache-redis": "4.2.8"

For now this has fixed the issue. I’ve checked it on node version v18.17.1.

fix by remove ^ in package.json node version v18.18.2

    "strapi-plugin-redis": "1.0.1",
    "strapi-plugin-rest-cache": "4.2.8",
    "strapi-provider-rest-cache-redis": "4.2.8"

Can you upgrade the strapi-plugin-redis package to v1.1.0 (not 1.0.1) I changed the Redis plugin to start building the redis connections in register rather than bootstrap so that Redis will start before any other plugins

Hey @muhammadaldan, this is not really a fix but a workaround. Could you reopen the issue, please?