#App errors because nodemailer

1 messages · Page 1 of 1 (latest)

harsh plinth
#

Hi everyone
Today I'm facing an error that I don't know how to solve it, already try to downgrade a few dependencies and didn't work.

Basically I setup renovate to update my dependencies and now my entire website is broken:

  • icons isn't render;
  • header isn't render the menus

And I'm totally out of ideas.
Could be related with last release of solid start?

#

These are the Pull Requests created by renovate
(the ones with red lines are related with sanity that are in the second "project" inside the monorepo)

#

I think I found the issue, I disable the SSR and ☝️

harsh plinth
#

for works, I need to put the transport creation inside my action

#

any idea how I can do it in a separated file?

harsh plinth
#
  const transporter = createTransport({
    host: env.email.host,
    from: env.email.email,
    port: env.email.port,
    secureConnection: env.email.secure,
    auth: {
      user: env.email.email,
      pass: env.email.password,
    },
  });

  // verify connection configuration
  transporter.verify((error, success) => {
    if (env.isProduction) {
      return;
    }

    if (error) {
      console.error('📥 Email server error:', error);
    } else {
      console.info('📤 Email server is ready to send messages!');
    }
  });

Any idea how I can do this in a specific file without crashing my app?

harsh plinth
#

Sorry to keep pushing this, but anyone have an idea how I can fix/improve this?

harsh plinth
#

App errors because nodemailer

thorn fiber
#

Probably your env variables are undefined.
So may need to install dotenv and import it in the file where you create the transport.

harsh plinth
#

But if I create the transporter inside the action works fine

thorn fiber
#

What happens if you log the env to the console outside the action ?
Are the vars available?

harsh plinth
#

The vars it's supposed to be working only on server side because I'm using process.env without VITE_

#

If I do:

function transporter() {
  'use server';

  const localTransporter = createTransport({
    host: env.email.host,
    from: env.email.email,
    port: env.email.port,
    secureConnection: env.email.secure,
    auth: {
      user: env.email.email,
      pass: env.email.password,
    },
  });

  // verify connection configuration
  localTransporter.verify((error, success) => {
    if (env.isProduction) {
      return;
    }

    if (error) {
      console.error('📥 Email server error:', error);
    } else {
      console.info('📤 Email server is ready to send messages!');
    }
  });

  return localTransporter;
}
#

works fine

#

but need to use as function to put the use server