From e364dd2c58b5406f8e4fd943049f0444ba791831 Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Sat, 20 Sep 2025 20:10:35 +0200 Subject: [PATCH 1/2] Fix job ID extraction in immediate processing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Job relationship returns job objects, not just IDs - Extract ID property from job object before passing to processJobById() - This fixes the '[object Object]' issue in logs and ensures job execution works 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/sendEmail.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sendEmail.ts b/src/sendEmail.ts index 9d86e96..b5cfb4d 100644 --- a/src/sendEmail.ts +++ b/src/sendEmail.ts @@ -182,9 +182,8 @@ export const sendEmail = async 0) { // Job found! Get the first job ID (should only be one for a new email) - jobId = Array.isArray(emailWithJobs.jobs) - ? String(emailWithJobs.jobs[0]) - : String(emailWithJobs.jobs) + const firstJob = Array.isArray(emailWithJobs.jobs) ? emailWithJobs.jobs[0] : emailWithJobs.jobs + jobId = typeof firstJob === 'string' ? firstJob : String(firstJob.id || firstJob) logger.info(`Found job ID: ${jobId}`) break } From 3f177cfeb5419d2dde5992fce7d0fbf05872ef6d Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Sat, 20 Sep 2025 20:11:00 +0200 Subject: [PATCH 2/2] Bump version to 0.4.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9a35b9c..8d18e89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xtr-dev/payload-mailing", - "version": "0.4.10", + "version": "0.4.11", "description": "Template-based email system with scheduling and job processing for PayloadCMS", "type": "module", "main": "dist/index.js",