Error message less-than-optimal when instrumentation cannot be loaded #78457
Labels
Instrumentation
Related to Next.js Instrumentation.
Runtime
Related to Node.js or Edge Runtime with Next.js.
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/pensive-feynman-lfsfss?file=%2Finstrumentation.ts
To Reproduce
Current vs. Expected behavior
Console output says:
It is correct behaviour that an error occurs since the file
instrumentation.ts
results in an error when loaded.Problem is that the actual error (in our case a zod error that occurs when the environment is parsed) is discarded, and a
TypeError
with no hint towards the actual error is thrown instead.Reason is line 479 in next-dev-server.js:
This line assumes hat the
message
property of the received error is writable, which may not be the case.Provide environment information
Which area(s) are affected? (Select all that apply)
Instrumentation, Runtime
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: