Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
adeelrqureshi opened this issue Mar 23, 2022 · 6 comments

Comments

@adeelrqureshi
Copy link

adeelrqureshi commented Mar 23, 2022

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 adeelrqureshi changed the title fn is not a function fn is not a function while setting up a pino transport via pipeline Mar 23, 2022
@adeelrqureshi adeelrqureshi changed the title fn is not a function while setting up a pino transport via pipeline Error: "fn is not a function" while setting up a pino transport via pipeline Mar 23, 2022
@mcollina
Copy link
Member

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.

@adeelrqureshi
Copy link
Author

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
Copy link
Author

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

@meotimdihia
Copy link

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')

@mcollina
Copy link
Member

Looks like a problem in pino-sentry

@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants