Skip to content

Commit bb21c59

Browse files
PDT42sjvans
andauthored
fix: skip queue metrics setup if no database is connected (#371)
Currently, queue.js will try to register the `.after` handler for collecting queue metrics even if the CAP app does not have a database, resulting in a crash on startup. --------- Co-authored-by: sjvans <[email protected]> Co-authored-by: D050513 <[email protected]>
1 parent 45ebdf7 commit bb21c59

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55
The format is based on [Keep a Changelog](http://keepachangelog.com/).
66

7+
## Version 1.5.3 - 2025-09-01
8+
9+
### Fixed
10+
11+
- Skip persistent queue metrics setup if no database is connected
12+
713
## Version 1.5.2 - 2025-08-18
814

915
### Fixed

lib/metrics/queue.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ module.exports = () => {
161161
const registeredServics = new Set()
162162

163163
cds.on('listening', () => {
164+
if (!cds.db) {
165+
cds.log('telemetry').debug('Skipping queue metrics setup as no database is connected')
166+
return
167+
}
168+
164169
const queueEntity = cds.model.definitions[PERSISTENT_QUEUE_DB_NAME]
165170
if (!queueEntity) return
166171

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cap-js/telemetry",
3-
"version": "1.5.2",
3+
"version": "1.5.3",
44
"description": "CDS plugin providing observability features, incl. automatic OpenTelemetry instrumentation.",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)