Nodemailer: Can't resolve 'crypto' /nodemailer/lib/dkim/sign.js #10997
Labels
bug
Something isn't working
invalid reproduction
The issue did not have a detectable valid reproduction URL
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Environment
import Nodemailer from '@auth/core/providers/nodemailer';
import { DrizzleAdapter } from '@auth/drizzle-adapter';
import type { NextAuthConfig } from 'next-auth';
import NextAuth from 'next-auth';
import { sendVerificationRequest } from '@/lib/sendVerificationRequest';
import { sendWelcomeEmail } from '@/lib/sendWelcomeEmail';
import { db } from './db';
export const authConfig = {
adapter: DrizzleAdapter(db),
providers: [
Nodemailer({
server: 'smtp://test@test.io:test@test.test.io:587',
from: 'xxxxx@xxxxx.xxxxxx',
sendVerificationRequest
})
],
callbacks: {
async session({ session, user }) {
// eslint-disable-next-line no-param-reassign
session.user.id = user.id;
return session;
}
},
pages: {
signIn: '/auth/sign-in',
verifyRequest: '/auth/verify-request',
error: '/auth/error'
},
events: {
async createUser(message) {
const params = {
name: message.user.name,
email: message.user.email
};
await sendWelcomeEmail(params);
}
}
} satisfies NextAuthConfig;
export const { handlers, auth, signOut, signIn } = NextAuth(authConfig);
▲ Next.js 14.2.3
Creating an optimized production build ...
[webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies
[webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies
Failed to compile.
./node_modules/nodemailer/lib/dkim/index.js:10:1
Module not found: Can't resolve 'fs'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/nodemailer/lib/mailer/index.js
./node_modules/nodemailer/lib/nodemailer.js
./node_modules/@auth/core/providers/nodemailer.js
./src/auth.ts
./src/app/api/v1/[[...route]]/route.ts
./node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js?absolutePagePath=private-next-app-dir%2Fapi%2Fv1%2F%5B%5B...route%5D%5D%2Froute.ts&page=%2Fapi%2Fv1%2F%5B%5B...route%5D%5D%2Froute&appDirLoader=bmV4dC1hcHAtbG9hZGVyP25hbWU9YXBwJTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2U9JTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2VQYXRoPXByaXZhdGUtbmV4dC1hcHAtZGlyJTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlLnRzJmFwcERpcj0lMkZVc2VycyUyRmF2YWJhZ2hlcnphZGVoJTJGRGVza3RvcCUyRnByb2plY3RzJTJGc2lkZS1wcm9qZWN0cyUyRmZpbGxpbnktbmV3JTJGZmlsbGlueS1hcHAlMkZzcmMlMkZhcHAmYXBwUGF0aHM9JTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2VFeHRlbnNpb25zPXRzeCZwYWdlRXh0ZW5zaW9ucz10cyZwYWdlRXh0ZW5zaW9ucz1qc3gmcGFnZUV4dGVuc2lvbnM9anMmYmFzZVBhdGg9JmFzc2V0UHJlZml4PSZuZXh0Q29uZmlnT3V0cHV0PSZwcmVmZXJyZWRSZWdpb249Jm1pZGRsZXdhcmVDb25maWc9ZTMwJTNEIQ%3D%3D&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!
./node_modules/nodemailer/lib/dkim/index.js:11:1
Module not found: Can't resolve 'path'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/nodemailer/lib/mailer/index.js
./node_modules/nodemailer/lib/nodemailer.js
./node_modules/@auth/core/providers/nodemailer.js
./src/auth.ts
./src/app/api/v1/[[...route]]/route.ts
./node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js?absolutePagePath=private-next-app-dir%2Fapi%2Fv1%2F%5B%5B...route%5D%5D%2Froute.ts&page=%2Fapi%2Fv1%2F%5B%5B...route%5D%5D%2Froute&appDirLoader=bmV4dC1hcHAtbG9hZGVyP25hbWU9YXBwJTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2U9JTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2VQYXRoPXByaXZhdGUtbmV4dC1hcHAtZGlyJTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlLnRzJmFwcERpcj0lMkZVc2VycyUyRmF2YWJhZ2hlcnphZGVoJTJGRGVza3RvcCUyRnByb2plY3RzJTJGc2lkZS1wcm9qZWN0cyUyRmZpbGxpbnktbmV3JTJGZmlsbGlueS1hcHAlMkZzcmMlMkZhcHAmYXBwUGF0aHM9JTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2VFeHRlbnNpb25zPXRzeCZwYWdlRXh0ZW5zaW9ucz10cyZwYWdlRXh0ZW5zaW9ucz1qc3gmcGFnZUV4dGVuc2lvbnM9anMmYmFzZVBhdGg9JmFzc2V0UHJlZml4PSZuZXh0Q29uZmlnT3V0cHV0PSZwcmVmZXJyZWRSZWdpb249Jm1pZGRsZXdhcmVDb25maWc9ZTMwJTNEIQ%3D%3D&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!
./node_modules/nodemailer/lib/dkim/index.js:12:1
Module not found: Can't resolve 'crypto'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/nodemailer/lib/mailer/index.js
./node_modules/nodemailer/lib/nodemailer.js
./node_modules/@auth/core/providers/nodemailer.js
./src/auth.ts
./src/app/api/v1/[[...route]]/route.ts
./node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js?absolutePagePath=private-next-app-dir%2Fapi%2Fv1%2F%5B%5B...route%5D%5D%2Froute.ts&page=%2Fapi%2Fv1%2F%5B%5B...route%5D%5D%2Froute&appDirLoader=bmV4dC1hcHAtbG9hZGVyP25hbWU9YXBwJTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2U9JTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2VQYXRoPXByaXZhdGUtbmV4dC1hcHAtZGlyJTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlLnRzJmFwcERpcj0lMkZVc2VycyUyRmF2YWJhZ2hlcnphZGVoJTJGRGVza3RvcCUyRnByb2plY3RzJTJGc2lkZS1wcm9qZWN0cyUyRmZpbGxpbnktbmV3JTJGZmlsbGlueS1hcHAlMkZzcmMlMkZhcHAmYXBwUGF0aHM9JTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2VFeHRlbnNpb25zPXRzeCZwYWdlRXh0ZW5zaW9ucz10cyZwYWdlRXh0ZW5zaW9ucz1qc3gmcGFnZUV4dGVuc2lvbnM9anMmYmFzZVBhdGg9JmFzc2V0UHJlZml4PSZuZXh0Q29uZmlnT3V0cHV0PSZwcmVmZXJyZWRSZWdpb249Jm1pZGRsZXdhcmVDb25maWc9ZTMwJTNEIQ%3D%3D&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!
./node_modules/nodemailer/lib/dkim/relaxed-body.js:6:1
Module not found: Can't resolve 'crypto'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/nodemailer/lib/dkim/index.js
./node_modules/nodemailer/lib/mailer/index.js
./node_modules/nodemailer/lib/nodemailer.js
./node_modules/@auth/core/providers/nodemailer.js
./src/auth.ts
./src/app/api/v1/[[...route]]/route.ts
./node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js?absolutePagePath=private-next-app-dir%2Fapi%2Fv1%2F%5B%5B...route%5D%5D%2Froute.ts&page=%2Fapi%2Fv1%2F%5B%5B...route%5D%5D%2Froute&appDirLoader=bmV4dC1hcHAtbG9hZGVyP25hbWU9YXBwJTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2U9JTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2VQYXRoPXByaXZhdGUtbmV4dC1hcHAtZGlyJTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlLnRzJmFwcERpcj0lMkZVc2VycyUyRmF2YWJhZ2hlcnphZGVoJTJGRGVza3RvcCUyRnByb2plY3RzJTJGc2lkZS1wcm9qZWN0cyUyRmZpbGxpbnktbmV3JTJGZmlsbGlueS1hcHAlMkZzcmMlMkZhcHAmYXBwUGF0aHM9JTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2VFeHRlbnNpb25zPXRzeCZwYWdlRXh0ZW5zaW9ucz10cyZwYWdlRXh0ZW5zaW9ucz1qc3gmcGFnZUV4dGVuc2lvbnM9anMmYmFzZVBhdGg9JmFzc2V0UHJlZml4PSZuZXh0Q29uZmlnT3V0cHV0PSZwcmVmZXJyZWRSZWdpb249Jm1pZGRsZXdhcmVDb25maWc9ZTMwJTNEIQ%3D%3D&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!
./node_modules/nodemailer/lib/dkim/sign.js:5:1
Module not found: Can't resolve 'crypto'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/nodemailer/lib/dkim/index.js
./node_modules/nodemailer/lib/mailer/index.js
./node_modules/nodemailer/lib/nodemailer.js
./node_modules/@auth/core/providers/nodemailer.js
./src/auth.ts
./src/app/api/v1/[[...route]]/route.ts
./node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js?absolutePagePath=private-next-app-dir%2Fapi%2Fv1%2F%5B%5B...route%5D%5D%2Froute.ts&page=%2Fapi%2Fv1%2F%5B%5B...route%5D%5D%2Froute&appDirLoader=bmV4dC1hcHAtbG9hZGVyP25hbWU9YXBwJTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2U9JTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2VQYXRoPXByaXZhdGUtbmV4dC1hcHAtZGlyJTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlLnRzJmFwcERpcj0lMkZVc2VycyUyRmF2YWJhZ2hlcnphZGVoJTJGRGVza3RvcCUyRnByb2plY3RzJTJGc2lkZS1wcm9qZWN0cyUyRmZpbGxpbnktbmV3JTJGZmlsbGlueS1hcHAlMkZzcmMlMkZhcHAmYXBwUGF0aHM9JTJGYXBpJTJGdjElMkYlNUIlNUIuLi5yb3V0ZSU1RCU1RCUyRnJvdXRlJnBhZ2VFeHRlbnNpb25zPXRzeCZwYWdlRXh0ZW5zaW9ucz10cyZwYWdlRXh0ZW5zaW9ucz1qc3gmcGFnZUV4dGVuc2lvbnM9anMmYmFzZVBhdGg9JmFzc2V0UHJlZml4PSZuZXh0Q29uZmlnT3V0cHV0PSZwcmVmZXJyZWRSZWdpb249Jm1pZGRsZXdhcmVDb25maWc9ZTMwJTNEIQ%3D%3D&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!
The text was updated successfully, but these errors were encountered: