nextauthjs / react-query Goto Github PK
View Code? Open in Web Editor NEWReact Query wrapper for NextAuth.js session management
React Query wrapper for NextAuth.js session management
Not sure how I broke it...
$ npm install --save @next-auth/react-query
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/next
npm ERR! next@"^11.0.0" from the root project
npm ERR! Could not resolve dependency:
npm ERR! peer next@"^10.0.3" from @next-auth/[email protected]
npm ERR! node_modules/@next-auth/react-query
npm ERR! @next-auth/react-query@"*" from the root project
...
next 11.1
next-auth 3.29.0
react-query 3.21.1
typescript 4.2.4
I am sory maybe sounds like the questions. I've existing next auth, and react-query setup. then i adding /nextauthjs/react-query
lib with
import { useSession } from "@next-auth/react-query"
const [session, loading] = useSession({
required: true,
redirectTo: "/auth/sign-in?error=InvalidSession",
queryConfig: {
staleTime: 60 * 60 * 3, // 3 hours
refetchInterval: 60 * 5 // 5 minutes
}
})
and i got some error
No QueryClient set, use QueryClientProvider to set one
any or something wrong or need additional setup on my code?
Please see the image or text below for further details:
./src/hooks/mutations/useUpdateUser.ts:1:0
Module not found: Package path . is not exported from package /Users/kripod/Development/folio/node_modules/@next-auth/react-query (see exports field in /Users/kripod/Development/folio/node_modules/@next-auth/react-query/package.json)
> 1 | import { useSession } from "@next-auth/react-query";
2 | import type { Session } from "next-auth";
3 | import { useMutation, useQueryClient } from "react-query";
4 |
I'm currently trying to use this library using the following versions of Nextjs and NextAuth, but having the below error:
dependencies:
next: 12.0.3
next-auth: 4.0.0-beta.6
node: v14.18.1
typescript: 4.4.4
error:
> Build error occurred
Error: Dynamic require of "react" is not supported
at xe (file:///myproject/node_modules/@next-auth/react-query/dist/index.mjs:1:294)
at file:///myproject/node_modules/@next-auth/react-query/dist/index.mjs:1:39268
at file:///myproject/node_modules/@next-auth/react-query/dist/index.mjs:1:373
at file:///myproject/node_modules/@next-auth/react-query/dist/index.mjs:4:497
at file:///myproject/node_modules/@next-auth/react-query/dist/index.mjs:1:373
at file:///myproject/node_modules/@next-auth/react-query/dist/index.mjs:4:14209
at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
at async Loader.import (internal/modules/esm/loader.js:178:24) {
type: 'Error'
}
Hi,
When I tried to use @next-auth/react-query, it showed following errors. Do you know what should I do for it? It seems that the index.js
is using import
syntax which is not allowed.
import { useQuery } from "react-query"
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (<anonymous>)
at Module._compile (internal/modules/cjs/loader.js:891:18)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.@next-auth/react-query (/home/kos/git/opensource/onr-react-ui/examples/next-starter/.next/server/pages/_app.js:2703:18)
at __webpack_require__ (/home/kos/git/opensource/onr-react-ui/examples/next-starter/.next/server/webpack-runtime.js:33:43)
at eval (webpack-internal:///./src/app/components/PageContainer.tsx:7:80)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.