You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the server side, the openapi-fetch works great: const settingsResponse = await client.GET("/api/settings/config-properties");
On the client side, it throws an error:
Error: Invariant: headers() expects to have requestAsyncStorage, none available.
at headers (webpack-internal:///(app-pages-browser)/./node_modules/next/dist/client/components/headers.js:38:15)
at eval (webpack-internal:///(app-pages-browser)/./node_modules/next-auth/lib/index.js:97:84)
at Object.onRequest (webpack-internal:///(app-pages-browser)/./src/lib/api/index.ts:11:78)
at coreFetch (webpack-internal:///(app-pages-browser)/./node_modules/openapi-fetch/dist/index.js:100:32)
at Object.GET (webpack-internal:///(app-pages-browser)/./node_modules/openapi-fetch/dist/index.js:163:14)
at Object.queryFn (webpack-internal:///(app-pages-browser)/./src/components/project-card-list.tsx:38:83)
at Object.fetchFn [as fn] (webpack-internal:///(app-pages-browser)/./node_modules/@tanstack/query-core/build/modern/query.js:195:27)
at run (webpack-internal:///(app-pages-browser)/./node_modules/@tanstack/query-core/build/modern/retryer.js:92:31)
at eval (webpack-internal:///(app-pages-browser)/./node_modules/@tanstack/query-core/build/modern/retryer.js:116:11)
My client component (components/project-card-list.tsx):
@borzaka That’s a good find! Maybe this would be a good addition to examples/next (since the React Query example is currently only client-side)? Or even a new examples/next-react-query would be great as well if you’re able to provide it
Description
My stack:
Reproduction
const settingsResponse = await client.GET("/api/settings/config-properties");
My client component (components/project-card-list.tsx):
My openapi-fetch client with Middleware (lib/api/index.ts):
I have followed the examples here for Next.js App Router to create the
QueryClientProvider
:https://tanstack.com/query/latest/docs/framework/react/guides/advanced-ssr
It works fine with native fetch:
What am I missing?
Expected result
Work as intended in client component with React Query.
Checklist
The text was updated successfully, but these errors were encountered: