Skip to content

Commit

Permalink
fix kafkaBridge headers sent error
Browse files Browse the repository at this point in the history
  • Loading branch information
mipyykko committed Mar 13, 2023
1 parent 8bdb5ad commit 59f5770
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backend/bin/kafkaBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ app.post("/kafka-bridge/api/v0/event", async (req, res) => {

try {
producer.produce(topic, null, Buffer.from(JSON.stringify(payload)))
flushProducer(1000).catch((err) => {
logger.warn(new KafkaError("Flushing the producer failed", err))
return res.status(500).json({ error: err.toString() }).send()
})
return flushProducer(1000)
.then(() => res.json({ msg: "Thanks!" }).send())
.catch((err) => {
logger.warn(new KafkaError("Flushing the producer failed", err))
return res.status(500).json({ error: err.toString() }).send()
})
} catch (e: any) {
logger.error(new KafkaError("Producing to kafka failed", e))
return res.status(500).json({ error: e.toString() }).send()
}

return res.json({ msg: "Thanks!" }).send()
})

app.get("/kafka-bridge/api/v0/healthz", (_, res) => {
Expand Down

0 comments on commit 59f5770

Please sign in to comment.