S
SolidJS13mo ago
TutoDS

App errors because nodemailer

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?
No description
No description
No description
10 Replies
TutoDS
TutoDSOP13mo ago
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)
TutoDS
TutoDSOP13mo ago
I think I found the issue, I disable the SSR and ☝️
No description
TutoDS
TutoDSOP13mo ago
for works, I need to put the transport creation inside my action any idea how I can do it in a separated file?
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!');
}
});
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? Sorry to keep pushing this, but anyone have an idea how I can fix/improve this?
Madaxen86
Madaxen8613mo ago
Probably your env variables are undefined. So may need to install dotenv and import it in the file where you create the transport.
TutoDS
TutoDSOP13mo ago
But if I create the transporter inside the action works fine
Madaxen86
Madaxen8613mo ago
What happens if you log the env to the console outside the action ? Are the vars available?
TutoDS
TutoDSOP13mo ago
The vars it's supposed to be working only on server side because I'm using process.env without VITE_
TutoDS
TutoDSOP13mo ago
No description
TutoDS
TutoDSOP13mo ago
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;
}
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
Madaxen86
Madaxen8613mo ago
There you go 👍.

Did you find this page helpful?