TheNinjrKillr
TheNinjrKillr
CCConvex Community
Created by TheNinjrKillr on 8/4/2024 in #support-community
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 😅
3 replies
CCConvex Community
Created by TheNinjrKillr on 4/29/2024 in #support-community
Convex+Clerk lack of Auth within preloadQuery
No description
6 replies
CCConvex Community
Created by TheNinjrKillr on 2/11/2024 in #support-community
Error on 3-expression Index
I've got this model in my schema:
accounts: defineTable({
user: v.id('users'),

type: v.string(),

provider: v.string(),
providerAccountID: v.string(),
})
.index('by_user', ['user'])
.index('by_provider', ['provider', 'providerAccountID'])
.index('by_provider_and_type', ['provider', 'providerAccountID', 'type']),
accounts: defineTable({
user: v.id('users'),

type: v.string(),

provider: v.string(),
providerAccountID: v.string(),
})
.index('by_user', ['user'])
.index('by_provider', ['provider', 'providerAccountID'])
.index('by_provider_and_type', ['provider', 'providerAccountID', 'type']),
And this mutation:
export const link = mutation({
args: {
account: v.object({
user: v.id('users'),

type: v.string(),

provider: v.string(),
providerAccountID: v.string(),
})
},
handler: async (ctx, args) => {
const account = await ctx.db.query('accounts')
.withIndex('by_provider_and_type', q => q.eq('provider', args.account.provider)
.eq('providerAccountID', args.account.providerAccountID)
.eq('type', args.account.type))
.first();

if(!account) return undefined;

return await ctx.db.patch(account._id, args.account )
}
});
export const link = mutation({
args: {
account: v.object({
user: v.id('users'),

type: v.string(),

provider: v.string(),
providerAccountID: v.string(),
})
},
handler: async (ctx, args) => {
const account = await ctx.db.query('accounts')
.withIndex('by_provider_and_type', q => q.eq('provider', args.account.provider)
.eq('providerAccountID', args.account.providerAccountID)
.eq('type', args.account.type))
.first();

if(!account) return undefined;

return await ctx.db.patch(account._id, args.account )
}
});
And I'm getting these two errors: convex/auth/account.ts:27:40 - error TS2345: Argument of type '"by_provider_and_type"' is not assignable to parameter of type '"by_user" | "by_provider" | "by_creation_time"'. convex/auth/account.ts:27:109 - error TS2339: Property 'eq' does not exist on type 'IndexRange'. Anyone have any suggestions?
4 replies