FerdinandF
Convex Community2y ago
9 replies
Ferdinand

fetch request on internal action

I am trying to send an email using nodemailer and gmail. I created an api in next js api app router.
export const newUserEmail = internalAction({
args: { email: v.string(), name: v.string() },
handler: async (ctx, args) => {
const newUser = await fetch('http://localhost:3000/api/email/newUser', {
method: 'POST',
body: JSON.stringify({ email: args.email, name: args.name }),
});

console.log('convex email', newUser);
return newUser;
},
});
I am getting this error from convex log:

Uncaught Error: Request to http://localhost:3000/api/email/deleteUser forbidden.
Please how can I resolve this.
Was this page helpful?