Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

fix(worker): fail gracefully when setting redis config #82

Carl-Gerhard Lindesvärd106df70ee292
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index a7d99e837..5f8d92cf1 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -293,8 +293,16 @@ const startServer = async () => {
port,
});
- // Notify when keys expires
- getRedisPub().config('SET', 'notify-keyspace-events', 'Ex');
+ try {
+ // Notify when keys expires
+ await getRedisPub().config('SET', 'notify-keyspace-events', 'Ex');
+ } catch (error) {
+ logger.warn('Failed to set redis notify-keyspace-events', error);
+ logger.warn(
+ 'If you use a managed Redis service, you may need to set this manually.',
+ );
+ logger.warn('Otherwise some functions may not work as expected.');
+ }
} catch (error) {
logger.error('Failed to start server', error);
}