-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix:(sks): Add queue between kafka and lambda #1067
Conversation
Coverage Report
File Coverage
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. What wizardry 🧙🏻♂️
const kafkaRecord = JSON.parse(sqsRecord.body) as KafkaRecord; | ||
|
||
const { key, value } = kafkaRecord; // sanity check | ||
if (!key || !value) { | ||
console.log("No key/value present. Possibly a tombstone or invalid data."); | ||
continue; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make a guard function that narrows the sqsRecord.body
to a KafkaRecord
const isKafkaRecord = (parsedBody: unknown): parsedBody is KafkaRecord => /* logic pertaining to kafkaRecord, i.e. typeof parsedBody === 'object' && parsedBody?.value */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that's a nit
🔧 Changes
processEmails.ts
to handle both Kafka and SQS events:processEmails.ts
:SendMessageCommand
.email.ts
stack:🚀 How to Test
DELAY_QUEUE_URL
) are set correctly in the Lambda configurations.📄 Additional Notes
processEmails.ts
handler now logs detailed debug information for both Kafka and SQS events, aiding in identifying potential issues.