Skip to content

Stuck can't start the plugin (see Image) #79

@muhammadaldan

Description

@muhammadaldan

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;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions