fix: handle pre-parsed JSON data in email processor
Mirror to GitHub / mirror (push) Successful in 22s
Test and Lint / backend-test (push) Successful in 1m5s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m29s
Version and Release / version-bump (push) Successful in 32s
Version and Release / trigger-drone (push) Successful in 2s
Mirror to GitHub / mirror (push) Successful in 22s
Test and Lint / backend-test (push) Successful in 1m5s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m29s
Version and Release / version-bump (push) Successful in 32s
Version and Release / trigger-drone (push) Successful in 2s
The email_data column in PostgreSQL is a JSON type that auto-parses the data, while SQLite stores it as a string. Updated the code to check if email_data is already an object before attempting to parse. This fixes the "Unexpected token o in JSON at position 1" error. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -350,7 +350,9 @@ async function processEmailQueue() {
|
|||||||
|
|
||||||
for (const email of pendingEmails) {
|
for (const email of pendingEmails) {
|
||||||
try {
|
try {
|
||||||
const emailData = JSON.parse(email.email_data || '{}');
|
const emailData = typeof email.email_data === 'string'
|
||||||
|
? JSON.parse(email.email_data || '{}')
|
||||||
|
: email.email_data || {};
|
||||||
|
|
||||||
await sendTemplateEmail(
|
await sendTemplateEmail(
|
||||||
email.recipient_email,
|
email.recipient_email,
|
||||||
|
|||||||
Reference in New Issue
Block a user