TheNinjrKillr
TheNinjrKillr9mo ago

Nodemailer as external package not working

Hi all! I have a project using nodemailer in a Node Action environment, but I'm getting this error:
✘ [ERROR] Could not resolve "nodemailer" convex/node_emails.ts:6:28: 6 │ import * as nodemailer from "nodemailer"; You can mark the path "nodemailer" as external to exclude it from the bundle, which will remove this error.
./convex.json
{
"node": {
"externalPackages": ["nodemailer"]
}
}
{
"node": {
"externalPackages": ["nodemailer"]
}
}
convex/node_emails.ts
"use node";

import { v } from "convex/values";
import { action, internalAction, internalQuery } from "./_generated/server";

import * as nodemailer from "nodemailer";
import { MailOptions } from "nodemailer/lib/json-transport";
"use node";

import { v } from "convex/values";
import { action, internalAction, internalQuery } from "./_generated/server";

import * as nodemailer from "nodemailer";
import { MailOptions } from "nodemailer/lib/json-transport";
What am I missing? It's got to be something obvious 😅
2 Replies
ballingt
ballingt9mo ago
Have you installed nodemailer? npm i nodemailer or similar
TheNinjrKillr
TheNinjrKillrOP9mo ago
🤦 Thanks @ballingt, I was fairly certain I had but evidently not

Did you find this page helpful?