🎉 1.3.0 is out! It features the new keyExpirationStrategy option for the redis-strings Handler!
Opt out the cache on Build

Building the App Without Redis Cache Connection

There are scenarios, especially during deployment, where your Redis server may not be immediately available. This can occur when the Redis server and your app are deployed simultaneously. In such cases, it's important to configure your build process to handle the absence of the Redis server. Here's how you can adapt your setup to build the app without requiring an active connection to the Redis server:

Configuration Steps

  1. Modify the cache-handler.mjs File: Adjust the onCreation method in your cache-handler.mjs file to conditionally connect to the Redis server. The modified code should look like this:

    CacheHandler.onCreation(async () => {
      let handler;
      if (process.env.REDIS_AVAILABLE) {
        await client.connect();
        handler = await createRedisHandler({
      return {
        handlers: [handler],
  2. Environment Variable Check: The process.env.REDIS_AVAILABLE environment variable is used to determine if the server has already started. This ensures that the Redis client attempts a connection only when the server is up and running. You may use a different environment variable or a more sophisticated check based on your deployment setup.