instrumentation.ts in a NX monorepo
Unanswered
wyatt posted this in #help-forum
wyattOP
we are using nextjs in a nx monorepo using that app folders and I can't get the register() function to be called.
The repo structure is
apps
--app1
----pages (folder)
----libs (folder)
----instrumentation.ts
--app2
----pages
----libs
I've added:
to next.config.js
and the instrumentation.ts file just tries to console log the logging level
Any idea what else I need to do to get this working in the nx monorepo? https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation
The repo structure is
apps
--app1
----pages (folder)
----libs (folder)
----instrumentation.ts
--app2
----pages
----libs
I've added:
experimental: {
instrumentationHook: true,
},to next.config.js
and the instrumentation.ts file just tries to console log the logging level
export async function register() {
const LOGGING_LEVEL = process.env.LOGGING_LEVEL || 'info';
logger.level = LOGGING_LEVEL;
console.log(`logging level is ${LOGGING_LEVEL}`)
}Any idea what else I need to do to get this working in the nx monorepo? https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation
2 Replies
Sedge Wren
@wyatt Did you manage to solve this issue?
Did you deploy on vercel too?