Diagnose and resolve common webhook issues
Webhook not receiving events
Signature verification failing
Slow or timeout responses
Inconsistent webhook delivery
function debugSignatureVerification(payload, signature, secret) { console.log('Debugging signature verification:'); console.log('Received signature:', signature); console.log('Webhook secret:', secret ? 'Present' : 'Missing'); // Parse signature components const elements = signature.split(','); console.log('Signature elements:', elements); if (elements.length !== 2) { console.error('Invalid signature format - should have timestamp and hash'); return false; } const timestamp = elements[0].split('=')[1]; const receivedHash = elements[1].split('=')[1]; console.log('Extracted timestamp:', timestamp); console.log('Extracted hash:', receivedHash); // Create signed payload const signedPayload = `${timestamp}.${JSON.stringify(payload)}`; console.log('Signed payload:', signedPayload); // Generate expected hash const expectedHash = crypto .createHmac('sha256', secret) .update(signedPayload) .digest('hex'); console.log('Expected hash:', expectedHash); console.log('Received hash:', receivedHash); console.log('Hashes match:', expectedHash === receivedHash); return expectedHash === receivedHash; }