Continuation-local storage shim for node-mysql that binds all callbacks passed to MySQL operations to a CLS namespace, enabling context propagation across asynchronous database calls. Current version 1.0.3 is stable but unmaintained. Requires peer dependencies `continuation-local-storage` ^3.1.3 and `mysql` ^2.5.4. Differentiates from similar CLS shims by specifically targeting the node-mysql driver. No significant release cadence; last update is years old.
npm install cls-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic setup: create CLS namespace, load cls-mysql shim, run a query inside the namespace and access context.
Migrate to AsyncLocalStorage-based context propagation (e.g., cls-hooked or direct AsyncLocalStorage).
Stick to mysql@^2.5.4 or use a different CLS shim for mysql2.
Move shim call before any mysql connection creation.
Use require('cls-mysql')(ns) with a valid CLS namespace object.Run npm install continuation-local-storage@^3.1.3
Run npm install mysql@^2.5.4