n8n-nodes-cakemail 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -334,23 +334,36 @@ class CakemailTrigger {
|
|
|
334
334
|
password: credentials.password,
|
|
335
335
|
baseURL: credentials.baseURL || 'https://api.cakemail.dev',
|
|
336
336
|
});
|
|
337
|
+
console.log('[Cakemail Webhook] Received webhook');
|
|
338
|
+
console.log('[Cakemail Webhook] Webhook name:', webhookName);
|
|
339
|
+
console.log('[Cakemail Webhook] Headers:', JSON.stringify(req.headers));
|
|
340
|
+
console.log('[Cakemail Webhook] Body:', JSON.stringify(req.body));
|
|
337
341
|
const signature = req.headers['x-signature'];
|
|
338
342
|
const secret = webhookName === 'setup'
|
|
339
343
|
? webhookData.setupWebhookSecret
|
|
340
344
|
: webhookData.webhookSecret;
|
|
345
|
+
console.log('[Cakemail Webhook] Signature present:', !!signature);
|
|
346
|
+
console.log('[Cakemail Webhook] Secret present:', !!secret);
|
|
347
|
+
console.log('[Cakemail Webhook] Secret length:', secret?.length);
|
|
341
348
|
if (!signature || !secret) {
|
|
349
|
+
console.log('[Cakemail Webhook] ERROR: Missing signature or secret');
|
|
342
350
|
return {
|
|
343
351
|
webhookResponse: { status: 401, body: 'Unauthorized: Missing signature' },
|
|
344
352
|
};
|
|
345
353
|
}
|
|
346
354
|
const rawBody = req.rawBody || JSON.stringify(req.body);
|
|
355
|
+
console.log('[Cakemail Webhook] rawBody available:', !!req.rawBody);
|
|
356
|
+
console.log('[Cakemail Webhook] rawBody length:', rawBody.length);
|
|
347
357
|
try {
|
|
348
358
|
const payload = client.webhooks.parsePayload(rawBody, signature, secret);
|
|
359
|
+
console.log('[Cakemail Webhook] SUCCESS: Signature verified');
|
|
349
360
|
return {
|
|
350
361
|
workflowData: [this.helpers.returnJsonArray(payload)],
|
|
351
362
|
};
|
|
352
363
|
}
|
|
353
364
|
catch (error) {
|
|
365
|
+
console.log('[Cakemail Webhook] ERROR: Signature verification failed');
|
|
366
|
+
console.log('[Cakemail Webhook] Error:', error instanceof Error ? error.message : String(error));
|
|
354
367
|
return {
|
|
355
368
|
webhookResponse: {
|
|
356
369
|
status: 403,
|
|
@@ -380,6 +380,12 @@ export class CakemailTrigger implements INodeType {
|
|
|
380
380
|
baseURL: credentials.baseURL as string || 'https://api.cakemail.dev',
|
|
381
381
|
});
|
|
382
382
|
|
|
383
|
+
// DEBUG: Log webhook receipt
|
|
384
|
+
console.log('[Cakemail Webhook] Received webhook');
|
|
385
|
+
console.log('[Cakemail Webhook] Webhook name:', webhookName);
|
|
386
|
+
console.log('[Cakemail Webhook] Headers:', JSON.stringify(req.headers));
|
|
387
|
+
console.log('[Cakemail Webhook] Body:', JSON.stringify(req.body));
|
|
388
|
+
|
|
383
389
|
// Get signature from header
|
|
384
390
|
const signature = req.headers['x-signature'] as string;
|
|
385
391
|
|
|
@@ -388,7 +394,12 @@ export class CakemailTrigger implements INodeType {
|
|
|
388
394
|
? (webhookData.setupWebhookSecret as string)
|
|
389
395
|
: (webhookData.webhookSecret as string);
|
|
390
396
|
|
|
397
|
+
console.log('[Cakemail Webhook] Signature present:', !!signature);
|
|
398
|
+
console.log('[Cakemail Webhook] Secret present:', !!secret);
|
|
399
|
+
console.log('[Cakemail Webhook] Secret length:', secret?.length);
|
|
400
|
+
|
|
391
401
|
if (!signature || !secret) {
|
|
402
|
+
console.log('[Cakemail Webhook] ERROR: Missing signature or secret');
|
|
392
403
|
return {
|
|
393
404
|
webhookResponse: { status: 401, body: 'Unauthorized: Missing signature' },
|
|
394
405
|
};
|
|
@@ -396,15 +407,20 @@ export class CakemailTrigger implements INodeType {
|
|
|
396
407
|
|
|
397
408
|
// Get raw body
|
|
398
409
|
const rawBody = (req as any).rawBody || JSON.stringify(req.body);
|
|
410
|
+
console.log('[Cakemail Webhook] rawBody available:', !!(req as any).rawBody);
|
|
411
|
+
console.log('[Cakemail Webhook] rawBody length:', rawBody.length);
|
|
399
412
|
|
|
400
413
|
// Verify signature
|
|
401
414
|
try {
|
|
402
415
|
const payload = client.webhooks.parsePayload(rawBody, signature, secret);
|
|
403
416
|
|
|
417
|
+
console.log('[Cakemail Webhook] SUCCESS: Signature verified');
|
|
404
418
|
return {
|
|
405
419
|
workflowData: [this.helpers.returnJsonArray(payload as any)],
|
|
406
420
|
};
|
|
407
421
|
} catch (error) {
|
|
422
|
+
console.log('[Cakemail Webhook] ERROR: Signature verification failed');
|
|
423
|
+
console.log('[Cakemail Webhook] Error:', error instanceof Error ? error.message : String(error));
|
|
408
424
|
return {
|
|
409
425
|
webhookResponse: {
|
|
410
426
|
status: 403,
|