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: unable to determine transport target for "@baselime/pino-transport" #2019

Open
jacobsamo opened this issue Jul 31, 2024 · 2 comments
Open

Comments

@jacobsamo
Copy link

For some reason getting the below error, works fine in development but not when built.

⨯ Error: unable to determine transport target for "@baselime/pino-transport"
    at fixTarget (/var/task/node_modules/pino/lib/transport.js:159:13)
    at /var/task/node_modules/pino/lib/transport.js:97:17
    at Array.map (<anonymous>)
    at Function.transport (/var/task/node_modules/pino/lib/transport.js:94:59)
    at /var/task/apps/web/.next/server/app/recipes/preview/[id]/edit/page.js:11:7702
    at 62666 (/var/task/apps/web/.next/server/app/recipes/preview/[id]/edit/page.js:11:7739)
    at t (/var/task/apps/web/.next/server/webpack-runtime.js:1:143)
    at 50073 (/var/task/apps/web/.next/server/app/recipes/preview/[id]/edit/page.js:11:4815)
    at t (/var/task/apps/web/.next/server/webpack-runtime.js:1:143)
    at 3724 (/var/task/apps/web/.next/server/app/recipes/preview/[id]/edit/page.js:11:5969) {
  page: '/recipes/preview/acffe450-7ce2-4a56-be89-1a8c985ce966/edit'
}

My logger code:
https://github.com/jacobsamo/Mixie/blob/mix-170-mvp-bug-fixes/apps/web/src/lib/services/logger/create-logger.ts

import { env } from "env";
import type { TransportTargetOptions } from "pino";
import pino from "pino";

export function createLogger({ dataset }: { dataset: string }) {

  const transport = pino.transport({
    target: "@baselime/pino-transport",
    options: {
      baselimeApiKey: env.BASELIME_KEY,
      dataset,
    },
  });

  return pino(transport);
}

Feel like I could fix this with a webpack config change or similar.

Repo link: https://github.com/jacobsamo/Mixie/tree/mix-170-mvp-bug-fixes

Similar issue to: #1964

@ustad-nordin
Copy link

I have exactly the same problem and made a small project to reproduce the error:
https://github.com/ustad-nordin/axiom-error

I hope someone take a look it and see what the problem is.

@mcollina
Copy link
Member

Considering how Vercel or Netlify works, it's better to load the transport as a stream, and use it in the main process. You'll only have problems in using a different thread in serverless systems.


The problem stems from the fact that threads requires an entrypoint on disk. When bundling, the logic we use to determine which file to load is somewhat broken. There are some example on how to do that for webpack, but none for vite. One would really be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants