Open
Description
Link to the code that reproduces this issue
https://github.com/JamesRobertWiseman/nextjs-otel-use-cache
To Reproduce
- Start the application in development (next dev)
- Visit the home page of the application
- Error will be present.
Error:

[ Server ] Error: Route "/" used `Math.random()` outside of `"use cache"` and without explicitly calling `await connection()` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-random
------------------
resolveErrorDev
./node_modules/.pnpm/[email protected]_@[email protected][email protected]_react@19_5el7z43pxvlkdtwozw72p3sfgu/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js
getOutlinedModel
./node_modules/.pnpm/[email protected]_@[email protected][email protected]_react@19_5el7z43pxvlkdtwozw72p3sfgu/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js
parseModelString
./node_modules/.pnpm/[email protected]_@[email protected][email protected]_react@19_5el7z43pxvlkdtwozw72p3sfgu/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js
Array.eval
./node_modules/.pnpm/[email protected]_@[email protected][email protected]_react@19_5el7z43pxvlkdtwozw72p3sfgu/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js
------------------
resolveConsoleEntry
./node_modules/.pnpm/[email protected]_@[email protected][email protected]_react@19_5el7z43pxvlkdtwozw72p3sfgu/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js
processFullStringRow
./node_modules/.pnpm/[email protected]_@[email protected][email protected]_react@19_5el7z43pxvlkdtwozw72p3sfgu/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js
processFullBinaryRow
./node_modules/.pnpm/[email protected]_@[email protected][email protected]_react@19_5el7z43pxvlkdtwozw72p3sfgu/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js
progress
./node_modules/.pnpm/[email protected]_@[email protected][email protected]_react@19_5el7z43pxvlkdtwozw72p3sfgu/node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js
Current vs. Expected behavior
Current:
Using dynamicIO
and @vercel/otel
results in math.random
outside of "use cache";
error.
Expected:
No error should appear, compiler should ignore any math.random calls in instrumentation.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #26~22.04.1-Ubuntu SMP Thu Jul 11 22:33:04 UTC 2024
Available memory (MB): 7930
Available CPU cores: 2
Binaries:
Node: 20.17.0
npm: 10.8.2
Yarn: 1.22.22
pnpm: 9.11.0
Relevant Packages:
next: 15.0.2-canary.10 // Latest available version is detected (15.0.2-canary.10).
eslint-config-next: N/A
react: 19.0.0-rc-02c0e824-20241028
react-dom: 19.0.0-rc-02c0e824-20241028
typescript: 5.3.3
Next.js Config:
output: N/A
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