fix tests

This commit is contained in:
geoffsee
2025-06-18 15:02:29 -04:00
parent b7f02eb4fb
commit afc46fe2c3
9 changed files with 63 additions and 142 deletions

View File

@@ -42,7 +42,11 @@ const MetricsService = types
headers: request.headers,
body: ["GET", "HEAD"].includes(request.method) ? null : request.body,
}
self.env.KV_STORAGE.put(`metrics_events::${crypto.randomUUID()}`, JSON.stringify(event));
if(self.env?.KV_STORAGE?.put) {
self.env.KV_STORAGE.put(`metrics_events::${crypto.randomUUID()}`, JSON.stringify(event));
} else {
console.log("Detected metrics misconfiguration...not storing")
}
}
}),
}));