PayU / prometheus-api-metrics

API and process monitoring with Prometheus for Node.js micro-service
Apache License 2.0
130 stars 44 forks source link

Error with vitest #120

Open AlexXi19 opened 10 months ago

AlexXi19 commented 10 months ago
TypeError: Cannot read properties of undefined (reading 'filename')
 ❯ Object.<anonymous> ../../node_modules/.pnpm/prometheus-api-metrics@3.2.2_prom-client@14.2.0/node_modules/prometheus-api-metrics/src/index.js:5:73

Running into error with vitest.

KuzinVadym commented 5 months ago

Has anyone else run into this problem? It happened in my code when I try to serve the nx application. Any chance that we can switch from require('pkginfo')(metricsMiddleware, { dir: Path.dirname(module.parent.filename), include: ['name', 'version'] }); to require('pkginfo')(metricsMiddleware, { dir: Path.dirname(module.parent ? module.parent.filename : module.filename ), include: ['name', 'version'] }); ?

I kind of 99% sure that this is somehow related to nx deamon because after building static and run it with node - everything working perfectly.