How to prevent instrumentation running during build #56328
Unanswered
captain-derp
asked this question in
App Router
Replies: 4 comments 1 reply
-
|
same problem for me |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
same here, using instrumentation to validate environment variables at server start and getting error on build, because server variables is not set yet.. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I successfully used https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation#importing-runtime-specific-code |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
experiencing same problem |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using the instrumentation.ts to initialize infrastructure services such as message queue and database client. This required fetching passwords from secure secret storage such as Azure KeyVault. However the problem is that instrumentation code is executed during build time inside a docker build environment. This means that the code will not have access to the credentials required to retrieve the passwords from KeyVault.
Why does next.js need to run the instrumentation code?
Is there a way to prevent next.js from running the instrumentation code while building?
Here is my Dockerfile:
Beta Was this translation helpful? Give feedback.
All reactions