-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Description
I have a nextjs application that uses newrelic as an external package, and it works fine locally and records data. When I deploy this app using vercel it doesn't record data, and this error appears in the logs:
New Relic for Node.js was unable to bootstrap itself due to an error:
Error: Cannot find module '/var/task/node_modules/newrelic/lib/util/is-string.js'
at createEsmNotFoundErr (node:internal/modules/cjs/loader:1249:15)
at finalizeEsmResolution (node:internal/modules/cjs/loader:1237:15)
at Module._resolveFilename (node:internal/modules/cjs/loader:1174:16)
at /var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:11:29005
at Module._load (node:internal/modules/cjs/loader:1043:27)
at /opt/rust/nodejs.js:2:13528
at Function.Vr (/opt/rust/nodejs.js:2:13906)
at Ue.e.<computed>.Be._load (/opt/rust/nodejs.js:2:13498)
at Module.require (node:internal/modules/cjs/loader:1298:19)
at u.require (/var/task/node_modules/next/dist/compiled/next-server/server.runtime.prod.js:11:29221)
I've looked at the build output locally, and this file path is not present in the function bundle. I think this is due to the fact that newrelic has to be in the experimental.serverComponentsExternalPackages list in the nextjs 14 config to work. Maybe since it's not using the nextjs version of require it's not going into the function bundle. However, if it's not marked as external, newrelic does not work.
Metadata
Metadata
Assignees
Labels
No labels