Xstoudi / pino-pg

A Pino Transport for PostgreSQL databases.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stream.on is not a function

hugomiguelbs opened this issue · comments

Hello,
I'm facing a problem using pino-pg
On my package.json, scripts area I have the following:

"dev": "nodemon --exec babel-node ./api/index.js | pino-pg --connectionUrl postgresql://xxxxxx:xxxxxxx@xxx.xxx.xx.xx:5432/dbname --table pinologs --column log",

But when running on console the command "npm run dev" the following appears:

internal/streams/pipeline.js:27
  stream.on('close', () => {
         ^

TypeError: stream.on is not a function
    at destroyer (internal/streams/pipeline.js:27:10)
    at internal/streams/pipeline.js:79:12
    at Array.map (<anonymous>)
    at Function.pipeline (internal/streams/pipeline.js:76:28)
    at client.connect (D:\Work\Project\node_modules\pino-pg\dist\src\index.js:57:18)
    at Connection.<anonymous> (D:\Work\Project\node_modules\pino-pg\node_modules\pg\lib\client.js:253:7)
    at Object.onceWrapper (events.js:273:13)
    at Connection.emit (events.js:187:15)
    at parse (D:\Work\Project\node_modules\pino-pg\node_modules\pg\lib\connection.js:109:10)
    at Parser.parse (D:\Work\Project\node_modules\pino-pg\node_modules\pg-protocol\dist\parser.js:40:17)

Hello, thank you for the report.

Can you run the following command and give me the output:

$ node -v

and your package.json.

v10.14.0

and your package.json.

{
  "name": "xxxxxx",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "nodemon --exec babel-node ./api/index.js | pino-pg --connectionUrl postgresql://xxxxxx:zzzzz@xx.xx.xx.xx:5432/xxxx--table pinologs --column log",
    "build": "rm -rf ./build && babel -d ./build ./api -s",
    "production": "npx babel-node ./build/index.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.19.2",
    "body-parser": "^1.19.0",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-fileupload": "^1.1.7-alpha.3",
    "express-pino-logger": "^5.0.0",
    "faker": "^4.1.0",
    "form-data": "^3.0.0",
    "jwt-simple": "^0.5.6",
    "multer": "^1.4.2",
    "node-oauth2-server": "^2.4.0",
    "node-plantuml": "^0.9.0",
    "nodemon": "^2.0.4",
    "passport": "^0.4.1",
    "passport-google-oauth": "^2.0.0",
    "passport-http-bearer": "^1.0.1",
    "path": "^0.12.7",
    "pg": "^8.2.1",
    "pg-hstore": "^2.3.3",
    "pino-pg": "^2.2.1",
    "sequelize": "^5.21.11",
    "sequelize-soft-delete": "^1.1.0",
    "simple-oauth2": "^4.0.0",
    "simple-oauth2-server": "^2.1.1",
    "swagger-ui-express": "^4.1.4",
    "uuid": "^8.1.0",
    "woocommerce-api": "^1.5.0"
  },
  "devDependencies": {
    "@babel/cli": "^7.10.1",
    "@babel/core": "^7.10.2",
    "@babel/node": "^7.10.1",
    "@babel/plugin-transform-runtime": "^7.10.1",
    "@babel/preset-env": "^7.10.2",
    "@babel/register": "^7.10.1",
    "@babel/runtime": "^7.10.2",
    "babel-loader": "^8.1.0",
    "chai": "^4.2.0",
    "chai-http": "^4.3.0",
    "eslint": "^7.1.0",
    "eslint-config-airbnb-base": "^14.1.0",
    "eslint-plugin-import": "^2.20.2",
    "mocha": "^8.1.2",
    "nyc": "^15.1.0"
  }
}

Hello,
Sorry for the delay.

First of all, verify that your version of pino-pg is up to date and retry. (in your package-lock.json)

Then, I am still unable to reproduce the issue right now. Could you eventually provide a GitHub repository with a reproduction of your error?

Thank you very much.

Same here, reverting to 2.2.0 fixes the issue.

Thanks devinellis.
That's interesting, it means that the problem come from a dependency and that a test is missing.
Could you provide a reproductible example?