From 95487cc83fc6fb3d16d4dd27008c62c0aa476017 Mon Sep 17 00:00:00 2001 From: mARTin Date: Sun, 1 Mar 2026 14:14:52 +0100 Subject: [PATCH] fix(email): increase SMTP timeout to 15s to prevent email dispatch failures on slow connections chore(release): bump version to 1.8.1 --- package.json | 2 +- src/lib/email.ts | 4 ++-- test-conn.js | 22 ++++++++++++++++++++++ test-db-2.js | 24 ++++++++++++++++++++++++ test-db.js | 17 +++++++++++++++++ test-email-auth.js | 35 +++++++++++++++++++++++++++++++++++ test-orig.js | 23 +++++++++++++++++++++++ test-tokens.js | 18 ++++++++++++++++++ 8 files changed, 142 insertions(+), 3 deletions(-) create mode 100644 test-conn.js create mode 100644 test-db-2.js create mode 100644 test-db.js create mode 100644 test-email-auth.js create mode 100644 test-orig.js create mode 100644 test-tokens.js diff --git a/package.json b/package.json index 07395f2..ea42692 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "my-weekly-todo-list", - "version": "1.8.0", + "version": "1.8.1", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "main": "index.js", "scripts": { diff --git a/src/lib/email.ts b/src/lib/email.ts index a06b5d5..d574cd2 100644 --- a/src/lib/email.ts +++ b/src/lib/email.ts @@ -113,9 +113,9 @@ export async function sendVerificationEmail( console.log(`======================================================\n`); try { - // 5 second timeout for SMTP + // 15 second timeout for SMTP const timeoutPromise = new Promise((_, reject) => - setTimeout(() => reject(new Error('SMTP timeout')), 5000) + setTimeout(() => reject(new Error('SMTP timeout')), 15000) ); const mailPromise = getTransporter().sendMail({ diff --git a/test-conn.js b/test-conn.js new file mode 100644 index 0000000..42cba1d --- /dev/null +++ b/test-conn.js @@ -0,0 +1,22 @@ +const { PrismaClient } = require('@prisma/client'); + +const prisma = new PrismaClient({ + datasources: { + db: { + url: "postgresql://postgres:pLQjZtDLYtAMu+ut5LamR5o9P1cgPE9Z@192.168.178.201:5432/postgres" + }, + }, +}) + +async function main() { + try { + const userCount = await prisma.user.count(); + console.log(`Connection successful! Users: ${userCount}`); + process.exit(0); + } catch (error) { + console.error('Connection failed:', error); + process.exit(1); + } +} + +main(); diff --git a/test-db-2.js b/test-db-2.js new file mode 100644 index 0000000..3030dee --- /dev/null +++ b/test-db-2.js @@ -0,0 +1,24 @@ +const { PrismaClient } = require('@prisma/client'); + +const prisma = new PrismaClient({ + datasources: { + db: { + url: "postgresql://postgres:SH8P%2FhUQljT4XahQVELX3Q%3D%3D@192.168.178.201:5432/postgres?pgbouncer=true" + }, + }, +}) + +async function main() { + try { + const userCount = await prisma.user.count(); + const taskCount = await prisma.task.count(); + console.log(`Users in database: ${userCount}`); + console.log(`Tasks in database: ${taskCount}`); + process.exit(0); + } catch (error) { + console.error('Error connecting to database:', error); + process.exit(1); + } +} + +main(); diff --git a/test-db.js b/test-db.js new file mode 100644 index 0000000..83d4345 --- /dev/null +++ b/test-db.js @@ -0,0 +1,17 @@ +const { PrismaClient } = require('@prisma/client'); +const prisma = new PrismaClient(); + +async function main() { + try { + const userCount = await prisma.user.count(); + const taskCount = await prisma.task.count(); + console.log(`Users in database: ${userCount}`); + console.log(`Tasks in database: ${taskCount}`); + process.exit(0); + } catch (error) { + console.error('Error connecting to database:', error); + process.exit(1); + } +} + +main(); diff --git a/test-email-auth.js b/test-email-auth.js new file mode 100644 index 0000000..ab616c3 --- /dev/null +++ b/test-email-auth.js @@ -0,0 +1,35 @@ +const nodemailer = require('nodemailer'); + +const transporter = nodemailer.createTransport({ + host: "w00ff033.kasserver.com", + port: 587, + secure: false, // true for 465, false for 587 + auth: { + user: "mail@carrylight.de", + pass: "QijU8e2A8p3FE8WS8esR", + }, +}); + +async function main() { + try { + console.log("Verifying connection..."); + await transporter.verify(); + console.log("Server is ready to take our messages"); + + console.log("Sending test email..."); + const info = await transporter.sendMail({ + from: '"Test" ', + to: "mail@martin-bierschenk.de", + subject: "Test Verification Email", + text: "This is a test email.", + }); + + console.log("Message sent: %s", info.messageId); + process.exit(0); + } catch (error) { + console.error("Error sending email:", error); + process.exit(1); + } +} + +main(); diff --git a/test-orig.js b/test-orig.js new file mode 100644 index 0000000..80e45dc --- /dev/null +++ b/test-orig.js @@ -0,0 +1,23 @@ +const { PrismaClient } = require('@prisma/client'); + +const prisma = new PrismaClient({ + datasources: { + db: { + url: "postgresql://root:WKE7xeZohxdZit7eObjG@192.168.178.91:2665/My-Weekly-ToDo-List?schema=public" + }, + }, +}) + +async function main() { + try { + const userCount = await prisma.user.count(); + const taskCount = await prisma.task.count(); + console.log(`Original DB - Users: ${userCount}, Tasks: ${taskCount}`); + process.exit(0); + } catch (error) { + console.error('Error connecting to original DB:', error); + process.exit(1); + } +} + +main(); diff --git a/test-tokens.js b/test-tokens.js new file mode 100644 index 0000000..624ef06 --- /dev/null +++ b/test-tokens.js @@ -0,0 +1,18 @@ +const { PrismaClient } = require('@prisma/client'); + +const prisma = new PrismaClient(); + +async function main() { + try { + const tokens = await prisma.verificationToken.findMany(); + const users = await prisma.user.findMany(); + console.log("Tokens:", tokens); + console.log("Users:", users); + process.exit(0); + } catch (error) { + console.error('Error fetching data:', error); + process.exit(1); + } +} + +main();