Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nitro] [uncaughtException] DiscordProvider is not a function #897

Closed
rarelywin opened this issue Sep 5, 2024 · 1 comment · Fixed by #898
Closed

[nitro] [uncaughtException] DiscordProvider is not a function #897

rarelywin opened this issue Sep 5, 2024 · 1 comment · Fixed by #898
Labels
documentation A change to the documentation question A question about NuxtAuth

Comments

@rarelywin
Copy link

rarelywin commented Sep 5, 2024

Environment


  • Operating System: Windows_NT
  • Node Version: v22.1.0
  • Nuxt Version: 3.13.0
  • CLI Version: 3.13.1
  • Nitro Version: 2.9.7
  • Package Manager: npm@10.7.0
  • Builder: -
  • User Config: compatibilityDate, devtools, modules, css, i18n, auth, runtimeConfig
  • Runtime Modules: @nuxtjs/tailwindcss@6.12.1, @nuxtjs/i18n@8.5.1, @sidebase/nuxt-auth@0.9.1
  • Build Modules: -

Reproduction

Describe the bug

server just not launching but should be, there is my [...].ts config

import { NuxtAuthHandler } from '#auth'
import DiscordProvider from 'next-auth/providers/discord';

export default NuxtAuthHandler({
secret: useRuntimeConfig().authSecret,
providers: [
DiscordProvider({
clientId: '',
clientSecret: ''
})
],
})

Additional context

No response

Logs

ERROR  [nitro] [uncaughtException] DiscordProvider is not a function

  at <anonymous> (server\api\auth\[...].ts:7:1)
  at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
  at async ModuleLoader.import (node:internal/modules/esm/loader:474:24)
  at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:119:5)
@rarelywin rarelywin added bug A bug that needs to be resolved pending An issue waiting for triage labels Sep 5, 2024
@phoenix-ru
Copy link
Collaborator

Please, make sure that you use .default in your configuration like so:

// @ts-expect-error You need to use .default here for it to work during SSR. May be fixed via Vite at some point
GithubProvider.default({

It is a bug with next-auth with Vite which forces such a workaround. This won't be needed with authjs in the future.

@phoenix-ru phoenix-ru added documentation A change to the documentation question A question about NuxtAuth and removed bug A bug that needs to be resolved pending An issue waiting for triage labels Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation A change to the documentation question A question about NuxtAuth
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants