Hi! I'm setting up email functionality via SendGrid, for next-payload. When I try to use the "Forgot password?" button, there's an error on the console:
ERROR (payload): TypeError: t is not a function
at forgotPassword (webpack-internal:///(api)/./node_modules/payload/dist/auth/operations/forgotPassword.js:44:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async handler (webpack-internal:///(api)/./src/pages/api/[collection]/forgot-password.ts:25:9)
Already tried to:
- manually install
i18next
- delete
.next
and
node_modules
and run
yarn
again
Hi @arielarial - sorry for the delay here! This issue was fixed by Jarrod recently, can you update to next-payload@latest and let me know if the error goes away?
Hi @jesschow , thanks for following through!
I've updated to
0.0.26
and indeed I'm not getting this error anymore. But I'm getting another one, now. See if you can help me with this, please.
When I click the "Forgot password?" button, everything looks fine in the browser, as the e-mail was sent. But in console there's a generic error:
[19:36:58] ERROR (payload): Failed to send mail to [xxx], subject: Reset Your Password
Relevant config and env file:
const transportOptions = {
host: process.env.SMTP_HOST,
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
port: process.env.SMTP_PORT,
secure: true,
tls: {
rejectUnauthorized: false,
},
};
export default buildConfig({
...
email: {
fromName: "hello",
fromAddress: "hello@example.com",
transportOptions,
},
...
});
SMTP_HOST=smtp.sendgrid.net
SMTP_USER=apikey
SMTP_PASS=xxx
SMTP_PORT=465
Ok, I've already found the problem 😓
I forgot to update the
fromAddress
config field with a proper
sender
that was configured in Sendgrid. It's working fine now. Thanks for the fix! ✨
niiice
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.