Description
CDS 10 replaces generic-pool as the database connection pool implementation with a built-in pooling mechanism. The generic-pool package is no longer a transitive dependency of @cap-js/db-service. Projects that rely on generic-pool being available in node_modules — either through a direct require('generic-pool') or as an undeclared transitive dependency — will encounter a module-not-found error at runtime. Additionally, pool configuration options set under cds.requires.db.pool may need to be reviewed, as the builtin implementation may not support all generic-pool-specific option names.
How to Check
- [ ] Search for
require('generic-pool')orimport ... from 'generic-pool'in application source files. - [ ] Check
cds envoutput forcds.requires.db.pool— if custom pool options are configured, verify whether they are supported by the builtin implementation. - [ ] Check
package.jsonfor a directdependencyordevDependencyongeneric-pool. - [ ] Check
package-lock.jsonorpnpm-lock.yamlforgeneric-poolappearing only as a transitive dependency (no direct declaration) — after upgrading, it will no longer be present.
Migration Steps
Remove any direct
require('generic-pool')usage and replace with the CAP pool API if one is available, or remove the dependency if it was only used indirectly:diff- const genericPool = require('generic-pool'); - const factory = { create: ..., destroy: ... }; - const pool = genericPool.createPool(factory, { max: 10 }); + // Use cds.requires.db connection management directly; + // custom pool factories are no longer needed.Remove
generic-poolfrompackage.jsonif it was declared as a direct dependency:diff{ "dependencies": { - "generic-pool": "^3.9.0" } }Review
cds.requires.db.poolconfiguration and align option names with the builtin implementation's supported options:diff{ "cds": { "requires": { "db": { "pool": { - "idleTimeoutMillis": 30000, - "acquireTimeoutMillis": 5000 + // Check CDS 10 release notes for supported pool option names } } } } }
Notes
This entry is unconfirmed — the official migration guide entry for this change has not been confirmed by the CAP team. Pool configuration option compatibility should be verified against the CDS 10 release notes before taking action. If the project does not configure cds.requires.db.pool and does not import generic-pool directly, no change is likely needed.