Server error with next auth. reddit provider not a function

Server error with next auth. reddit provider not a function

Problem Description:

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 – 1

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.

Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Reject