wobsoriano / authey Goto Github PK
View Code? Open in Web Editor NEWUniversal support for Auth.js.
License: MIT License
Universal support for Auth.js.
License: MIT License
Getting error when running authey:
Error: No "exports" main defined in node_modules/@auth/core/package.json
Hi there ๐
I just started a POC using your lib along with @auth/core
. Seems to be working great so far, but i'm getting a peer dependency error from authey because @auth/core
is now on 0.10.0
.
npm ERR! While resolving: [email protected]
npm ERR! Found: @auth/[email protected]
npm ERR! node_modules/@auth/core
npm ERR! @auth/core@"^0.10.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @auth/core@"^0.9.0" from [email protected]
npm ERR! node_modules/authey
npm ERR! authey@"^0.7.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @auth/[email protected]
npm ERR! node_modules/@auth/core
npm ERR! peer @auth/core@"^0.9.0" from [email protected]
npm ERR! node_modules/authey
npm ERR! authey@"^0.7.0" from the root project
I'd love to use this in my nuxt app, but the @auth/core
dependency is a few versions behind.
I get this error when trying to install authey
alongside the latest version of @auth/core
:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: @auth/[email protected]
npm ERR! node_modules/@auth/core
npm ERR! @auth/core@"^0.5.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @auth/core@"^0.3.0" from [email protected]
npm ERR! node_modules/authey
npm ERR! authey@"*" from the root project
Related nodejs/node#46221
{
"type": "TypeError",
"message": "RequestInit: duplex option is required when sending a body.",
"stack":
TypeError: RequestInit: duplex option is required when sending a body.
at new Request (node:internal/deps/undici/undici:7225:19)
at createNodeRequest (file:///___/node_modules/authey/dist/index.mjs:32:10)
at file:///___/node_modules/authey/dist/index.mjs:105:23
at Holder.done (___\node_modules\@fastify\middie\engine.js:112:11)
at Object.run (___\node_modules\@fastify\middie\engine.js:59:12)
at Object.runMiddie (file:///___/node_modules/fastify-next-auth/dist/index.mjs:21:12)
at hookIterator (___\node_modules\fastify\lib\hooks.js:293:10)
at next (___\node_modules\fastify\lib\hooks.js:185:16)
at handleResolve (___\node_modules\fastify\lib\hooks.js:196:5)
}
Adding duplex: 'half'
between line 30 & 31 in src/fetch.ts
fixes it.
https://github.com/wobsoriano/authey/blob/main/src/fetch.ts#L24-L37
Running Node.js v18.16.0, fastify 4.16.3, fastify-next-auth 0.3.0
https://authjs.dev/reference/rest-api <-- does not exist. BUt those docs admit to being incomplete. Assuming it is the same as https://next-auth.js.org/getting-started/rest-api , maybe link there until Auth.js docs cacth up?
I think there was a mix up here with what looks like attempting to set default values for some of the provided options to both createAuthMiddleware
and getSession
.
In the following code:
Lines 65 to 72 in a49cccd
You can see that both options.secret
and options.trustHost
are set after being destructured to authOptions
.
Perhaps something like the following was intended:
const {
prefix = '/api/auth',
conform = (_: Request) => (res: Response) => res,
...authOptions
} = options
authOptions.secret ??= process.env.AUTH_SECRET
authOptions.trustHost ??= shouldTrustHost()
The same issue applies to getSession
.
nit: i would argue that the previous form was also not the best as it was mutating the options passed in to the function, which consumers may not be expecting.
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.