mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 08:13:23 +00:00
Fix job ID extraction in immediate processing
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -182,9 +182,8 @@ export const sendEmail = async <TEmail extends BaseEmailDocument = BaseEmailDocu
|
||||
|
||||
if (emailWithJobs.jobs && emailWithJobs.jobs.length > 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user