nextauthjs / next-auth

Authentication for the Web.
https://authjs.dev
ISC License
24.37k stars 3.41k forks source link

SvelteKitAuth: No Call signature for Email in @auth/core/providers/email #6497

Open Wr4ngla opened 1 year ago

Wr4ngla commented 1 year ago

Environment

System: OS: Linux 6.0 Pop!_OS 22.04 LTS CPU: (8) x64 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz Memory: 2.70 GB / 7.60 GB Shell: 5.8.1 - /usr/bin/zsh Binaries: Node: 18.12.1 - /usr/bin/node npm: 9.2.0 - /usr/bin/npm Browsers: Firefox: 108.0

Reproduction URL

https://github.com/nextauthjs/sveltekit-auth-example

Describe the issue

this expression is not callable. Type 'typeof import(".../node_modules/@auth/core/providers/email")' has no call signatures.ts(2349)

--> build error: TypeError: __vite_ssr_import_4__.default.default is not a function at /home/.../src/hooks.server.ts:47:17 at async instantiateModule (file:///home/.../node_modules/vite/dist/node/chunks/dep-5e7f419b.js:52224:9)

How to reproduce

  1. Clone the repo
  2. Install the repo
  3. npm run dev

Expected behavior

expected build to complete without errors.

benquan commented 1 year ago

Same issue.

This is the modified hooks file

import { SvelteKitAuth } from '@auth/sveltekit';
import EmailProvider from '@auth/core/providers/email';

import {
    EMAIL_SERVER,
    EMAIL_FROM
} from '$env/static/private';

export const handle = SvelteKitAuth({
    providers: [
        EmailProvider({
            server: EMAIL_SERVER,
            from: EMAIL_FROM
        }),
    ] 
});
benquan commented 1 year ago

Solved the problem

use import EmailProvider from 'next-auth/providers/email';

I guess @auth/core email is still in development???

binaryme commented 1 year ago

I'm getting the same error. Tried using import EmailProvider from 'next-auth/providers/email'; but still I get the same issue

also tried to harcode @OrJDev pr changes into my @auth but error persist.

OrJDev commented 1 year ago

I'm getting the same error. Tried using import EmailProvider from 'next-auth/providers/email'; but still I get the same issue

also tried to harcode @OrJDev pr changes into my @auth but error persist.

that is because you misused my solution

it should be email.js and not email.ts

i also replied to you saying that: https://github.com/nextauthjs/next-auth/pull/6615#discussion_r1096558020

OrJDev commented 1 year ago

this was fixed in https://github.com/nextauthjs/next-auth/commit/b91167091cf12c9689240156f2538c708be005b8

benquan commented 1 year ago

Confirming it works with import { Email } from '@auth/core/providers/email';

be sure to install nodemailer. It is not included in npm @auth/core

coryvirok commented 8 months ago

Possibly related - https://github.com/nextauthjs/next-auth/commit/8f0226bcc4cf777d03567ed826bf96f5989d56ad#r138256101

coryvirok commented 8 months ago

Possibly related - 8f0226b#r138256101

Ah, I see this was fixed recently, nevermind. The types are still messed up (e.g. Nodemailer cannot take a server: string) but the import works.