pino icon indicating copy to clipboard operation
pino copied to clipboard

Error: "fn is not a function" while setting up a pino transport via pipeline

Open adeelrqureshi opened this issue 3 years ago • 5 comments
trafficstars

I'm not able to figure out what might be going wrong here,I am trying to set up a pino transport via pipelines and I get the following error . Looks like its reaching a condition where fn remains un-initialized

Any help clues would be greatly appreciated, My apologies if sufficient detail isn't provided as posting for the 1st time

TypeError: fn is not a function at /project/user-app/node_modules/pino/lib/worker-pipeline.js:26:26 at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Promise.all (index 0) at async module.exports (/project/user-app/node_modules/pino/lib/worker-pipeline.js:13:19) at async start (/project/user-app/node_modules/thread-stream/lib/worker.js:57:17) Emitted 'error' event on ThreadStream instance at: at destroy (/project/user-app/node_modules/thread-stream/index.js:349:12) at Worker.onWorkerMessage (/project/user-app/node_modules/thread-stream/index.js:164:7) at Worker.emit (events.js:315:20) at MessagePort. (internal/worker.js:192:55) at MessagePort.emit (events.js:315:20) at MessagePort.onmessage (internal/worker/io.js:78:8) at MessagePort.exports.emitMessage (internal/per_context/messageport.js:11:10) at Worker.[kOnExit] (internal/worker.js:213:5) at Worker..onexit (internal/worker.js:160:20)

adeelrqureshi avatar Mar 23 '22 21:03 adeelrqureshi

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

mcollina avatar Mar 23 '22 21:03 mcollina

Thanks @mcollina for the quick response. Let me see if I can setup a small repo ( by removing unnecessary code) that allows to reproduce this.

adeelrqureshi avatar Mar 24 '22 09:03 adeelrqureshi

Unfortunately i'm not able to re-produce this by creating a lean docker image, but its appearing consistently on my Staging Openshift build. This may be related to how openshift is building my image and not relevant with the pino itself. I'll post updates here if i'm able to find anything more relevant

Thankyou

adeelrqureshi avatar Mar 24 '22 15:03 adeelrqureshi

I am getting this error, with both example:

import pino from "pino"

async function main() {
  const transport = pino.transport({
    targets: [
      {
        target: "pino-sentry",
        options: {
          dsn: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        },
        level: "error"
      }
    ],
  })
  const logger = pino(
    transport
  )
  logger.error('test')
}
main()
  .catch(async e => {
    console.error(e)
  })
import pino from "pino"
import { createWriteStream as createSentryStream } from "pino-sentry/dist/transport"

const streams = []
const sentryStream = createSentryStream({
  dsn: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
})
streams.push({
  stream: sentryStream,
})

const logger = pino(
  {
    level: 'debug'
  },
  pino.multistream(streams)
)

 logger.error('test')

meotimdihia avatar Apr 23 '22 11:04 meotimdihia

Looks like a problem in pino-sentry

mcollina avatar Apr 23 '22 12:04 mcollina

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Feb 18 '23 00:02 github-actions[bot]