Open JamesRobertWiseman opened 3 weeks ago
@unstubbable appreciate your assistance in looking into this. Let me know if I can assist in any way.
I've gotten the above error, but I also get something similar when I use Date.now() - 'Route "/route" used Date.now()
instead of using performance
or without explicitly calling await connection()
beforehand'. Would the PR address this as well?
I've gotten the above error, but I also get something similar when I use Date.now() - 'Route "/route" used
Date.now()
instead of usingperformance
or without explicitly callingawait connection()
beforehand'. Would the PR address this as well?
No, this issue is specifically for the internal Math.random()
usage in @vercel/otel
.
When you use Date.now()
in your application code with dynamicIO
enabled, you need to express how you intend to use the date. I.e. is it supposed to be used in a static or dynamic context? You can find more info at https://nextjs.org/docs/messages/next-prerender-current-time.
@unstubbable // is there any escape hatch for custom open telemetry(instead of @vercel/otel
)? especially, random id generator depends on Math.random()
things.
Link to the code that reproduces this issue
https://github.com/JamesRobertWiseman/nextjs-otel-use-cache
To Reproduce
Current vs. Expected behavior
Current:
Using
dynamicIO
and@vercel/otel
results inmath.random
outside of"use cache";
error.Expected:
No error should appear, compiler should ignore any math.random calls in instrumentation.
Provide environment information
Which area(s) are affected? (Select all that apply)
Instrumentation, Performance
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response