TanStackT
TanStack15mo ago
5 replies
foolish-indigo

new QueryClient throws error on NextJS with dynamicIO enabled.

When using react-query with nextjs@15.0.3-canary.4 with dynamicIO enabled I get the following error when trying to create a query client.

Error: Route "/" used `Date.now()` instead of using `performance` or without explicitly calling `await connection()` beforehand. See more info here: https://nextjs.org/docs/messages/next-prerender-current-time
    at io (node_modules/next/src/server/node-environment-extensions/utils.tsx:33:31)
    at now (node_modules/next/src/server/node-environment-extensions/date.tsx:17:9)
    at createQueryClient (src/trpc/query-client.ts:5:2)
    at createQueryClient (src/trpc/react.tsx:17:28)
    at getQueryClient (src/trpc/react.tsx:41:22)
  3 |
  4 | export const createQueryClient = () =>
> 5 |   new QueryClient({
    |  ^
  6 |     defaultOptions: {
  7 |       queries: {


Is there any way to solve this on my side? Or is this something that needs to be fixed inside of tanstack-query to support dynamicIO?
Was this page helpful?