Open therealmanny opened 1 year ago
Got the exact same problem using next
version 13.5.5 and @grafana/faro-web-sdk
version 1.2.2
If I add new TracingInstrumentation(),
to my instrumentations I get the exact same error.
hi @therealmanny i've same problem with you but I'm runnings my web with nuxt. can you tell me the node version in your device? thank you.
Also running w/ Next.js, I noticed all my handled promise errors under then/catch gets an Unhandled Runtime Error on my screen.
It seems zone.js is breaking the show
Now in August 2024, I am running into similar issue with NextJs 14.2.5 (Node 20.9.0), and I have the latest package version for faro
"@grafana/faro-react": "^1.9.0",
"@grafana/faro-web-sdk": "^1.9.0",
"@grafana/faro-web-tracing": "^1.9.0",
The error message I got when run next build
.
Node.js v20.9.0
⨯ Static worker exited with code: 1 and signal: null
⨯ Static worker exited with code: 1 and signal: null
Generating static pages (0/2) [ =]node:internal/event_target:1083
process.nextTick(() => { throw err; });
^
Error [ERR_INTERNAL_ASSERTION]: Unknown worker message type message
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
at new NodeError (node:internal/errors:406:5)
at Function.fail (node:internal/assert:20:9)
at [kOnMessage] (node:internal/worker:354:12)
at MessagePort.<anonymous> (node:internal/worker:232:57)
at _ZoneDelegate.invokeTask (/Users/x/workspace/dotcom-next-gen-flume/node_modules/zone.js/bundles/zone.umd.js:443:35)
at Zone.runTask (/Users/x/workspace/dotcom-next-gen-flume/node_modules/zone.js/bundles/zone.umd.js:214:51)
at ZoneTask.invokeTask [as invoke] (/Users/xinjiang.shao/workspace/dotcom-next-gen-flume/node_modules/zone.js/bundles/zone.umd.js:525:38)
at invokeTask (/Users/x/workspace/dotcom-next-gen-flume/node_modules/zone.js/bundles/zone.umd.js:1727:22)
at globalCallback (/Users/x/workspace/dotcom-next-gen-flume/node_modules/zone.js/bundles/zone.umd.js:1758:31)
at MessagePort.globalZoneAwareCallback (/Users/xx/workspace/dotcom-next-gen-flume/node_modules/zone.js/bundles/zone.umd.js:1794:20) {
code: 'ERR_INTERNAL_ASSERTION'
}
Hi @soleo can you test one thing. I have a suspicion that a dependency may cause this error.
Would you mind trying to remove/not add the web-tracing package and see if the error is still there?
@codecapitano I did test with TracingInstrumentation()
removed, and the build did pass.
The initialization for Faro is very similar to what @jpmcb did in https://github.com/open-sauced/app/pull/3139
export const initGrafanaFaro = () => {
return initializeFaro({
url: process.env.FARO_URL,
app: {
name: process.env.APP_NAME,
version: version,
environment: process.env.ENVIRONMENT_NAME,
},
instrumentations: [
// load the mandatory web instrumentation
...getWebInstrumentations({
captureConsole: true,
}),
// add tracing instrumentation which should include the React Profiler
// new TracingInstrumentation(),
new ReactIntegration({
// In the future, we may choose to integrate with React router instrumentation to
// get deeper metrics on matched routes, navigation types, etc.
// Next/router doesn't seem to be supported which won't give us route metrics.
//
// Reference: https://github.com/grafana/faro-web-sdk/tree/main/packages/react
//
// router: {}
}),
],
});
};
With that being said, we do wanna get the web tracing working in order to have better visibility. Is there a recommended path for nextjs apps?
Hi @soleo
I think you run Faro on the server as well? Faro is client only.
So you need to ensure that Faro is running in the client only. Afaik this can be configured in Next by the useClient pragma.
To instrument the server we recommend to use opentelemetry-node.
You can find an example in next docs: Manual OpenTelemetry configuration
cc @cedricziel
Description
I get the following errors when I add TracingInstrumentation to my NextJS application.
I have tried a couple of things to fix it, including deleting the node_modules folder and reinstalling the packages. I also upgraded the NextJS and other packages. But I still got the same errors. Thanks, for taking a look at this issue.
Steps to reproduce
Expected behavior
There should be no errors when the app starts up.
Actual behavior
The following errors are created when the app starts up.
Environment
Demo
Context
Package.json dependencies
Faro initialization (initialize.ts)
_app.tsx