diff --git a/src/api/common/push-sw.ts b/src/api/common/push-sw.ts
index 927dc50635..782a4a6a6c 100644
--- a/src/api/common/push-sw.ts
+++ b/src/api/common/push-sw.ts
@@ -3,9 +3,13 @@ import * as mongo from 'mongodb';
 import Subscription from '../models/sw-subscription';
 import config from '../../conf';
 
-push.setGCMAPIKey(config.sw.gcm_api_key);
+if (config.sw) {
+	push.setGCMAPIKey(config.sw.gcm_api_key);
+}
 
 export default async function(userId: mongo.ObjectID | string, type, body?) {
+	if (!config.sw) return;
+
 	if (typeof userId === 'string') {
 		userId = new mongo.ObjectID(userId);
 	}