Search code examples
reactjsnext.jsprovidernext-auth

Server error with next auth. reddit provider not a function


I'm getting a server error with next-auth. I believe I used [...nextauth].js correctly but it's saying my () after my providers is incorrect. Finding docs regarding Reddit is tough with next.js

here is the file my error is happening

'TypeError: (0 , next_auth_providers_reddit__WEBPACK_IMPORTED_MODULE_1__.RedditProvider) is not a function'

[...nextauth].js

import { NextAuth } from 'next-auth';
import { RedditProvider } from 'next-auth/providers/reddit';

export const authOptions = {
    providers: [
        RedditProvider({
            clientId: process.env.REDDIT_CLIENT_ID,
            clientSecret: process.env.REDDIT_CLIENT_SECRET,
        }),
    ],
};

export default NextAuth(authOptions);

does anyone see the issue that is causing this?


Solution

  • import RedditProvider from "next-auth/providers/reddit"
    

    Which version of next-auth are you using. In my case, Reddit provider is a default export so no need for curly braces.