Closed x751685875 closed 1 year ago
Thanks for reporting
Any progress on this? Hitting it myself.
This is an issue on next-auth
side and waiting for it to be fixed so I can release a new version. Meanwhile, here's an ugly fix:
import { type Provider } from '@auth/core/providers'
app
.register(AuthPlugin, {
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_ID,
clientSecret: process.env.GOOGLE_SECRET,
}) as Provider,
],
})
In my case the AuthPlugin itself has the wrong type. "I was expecting FastifyPluginAsync<AuthConfig, RawServerDefault, FastifyTypeProviderDefault, FastifyBaseLogger>, but you passed FastifyPluginCallback<AuthConfig, RawServerDefault, FastifyTypeProviderDefault> "
FastifyBaseLogger is missing in generics.
"fastify": "^4.18.0", "fastify-plugin": "^4.5.0",
@teddybee I don't think that's the issue. Check this basic repro - https://github.com/wobsoriano/auth-provider-type-repro
I am not 100% sure, but i think your index.d.ts should look like this
declare const fastifyNextAuth: fastify.FastifyPluginAsync<AuthConfig, fastify.RawServerDefault, fastify.FastifyTypeProviderDefault, fastify.FastifyBaseLogger>;
declare module 'fastify' {
interface FastifyInstance {
getSession(req: FastifyRequest): Session;
}
}
export { fastifyNextAuth as default, fastifyNextAuth };
Although I still have error with the trustHost field.
P.S.: it is working now, your type is good as well inside a plugin The trustHost line is faulity in the description. It needs to be set to true instead of an url.
Please update to the latest version and use @auth/core
>= 0.8.3.