Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

TypeError: t is not a function at forgotPassword

default discord avatar
arielarial2 years ago
3

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

  • default discord avatar
    jessrynkar2 years ago

    Hi

    @736673642158620680

    - 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?

  • default discord avatar
    arielarial2 years ago

    Hi

    @854377910689202256

    , 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! ✨

  • discord user avatar
    jmikrut
    2 years ago

    niiice

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.