Open grazianodev opened 2 years ago
Yes, I read the url. I guess you mean that the error is due to the Sentry package, however I only get that error when using pino-sentry, so I'm not sure... sorry if I made a mistake.
Anyway, I did create a reproduction. It's a basic create-next-app, to which I've only added the packages and logger code that I posted in my first message.
I'm guessing you're trying to load pino to client side code:
and hence the error.
I'm not familiar with next.js, so it might take some time to for me to process it through
however, the problem could be also the way next.js does bundling. pino has some docs about it:
you forgot to add instructions. and what's the reproduce steps there? yarn && yarn dev
?
I'm guessing you're trying to load pino to client side code
I do successfully use pino on the client side already and I do not get that error. The error only shows up as soon as I import createWriteStream
from pino-sentry.
As for the repro, I use npm and do npm install
and then npm run dev
, which I think is the equivalent yarn && yarn dev
. Once you launch the app you immediately get the error, but then if you go into logger.js
(in the root folder) and comment out import { createWriteStream } from "pino-sentry"
, the error goes away, the page loads fine and in the console you should read This is a test log
, which is a log I added in the homepage with pino's logger.info
(which, incidentally, should demonstrate that pino works on the client).
Thanks for your help!
no error here
➜ yarn && yarn dev
yarn install v1.22.19
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] 🔍 Resolving packages...
success Already up-to-date.
✨ Done in 0.34s.
yarn run v1.22.19
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
event - compiled client and server successfully in 654 ms (173 modules)
Hello @glensc
I am currently facing the same issue. I have just added into my project pino-sentry and faced the same issue.
Maybe is a node.js related issue?
My versions are
"@sentry/nextjs": "7.11.1",
"pino-sentry": "0.13.0",
"next": "12.2.5",
node version: v16.15.1
I will try to reproduce the repo or use the repo provided by @grazianodev
thanks!
EDIT: I have cloned the reproduction repo and I got the same issue
My steps:
Thanks!
EDIT 2: I wonder if this could be a dependencies version issue?
in transport.js you are referencing child_process
And I have spotted this issue from the original Sentry integration https://github.com/getsentry/sentry-javascript/issues/5787
Same issue here! Using NextJS T3 Stack.
Hello,
I've installed pino-sentry in a Next.js project, however even by just importing from the package like this:
I get the following error:
I would really like to try and use pino-sentry so any help would be appreciated! These are my package versions in case it matters: