Hey! I've checked my setup and found some manual header settings that I've commented out, but the CRLF error is still happening. Here's my current setup:
1. Framework: Express.js with TypeScript
2. Server Setup (server.ts - main middleware file):
// Middleware
server.use(cors());
// Raw body parser for Stripe webhooks (must be before express.json())
server.use('/api/webhooks/stripe-webhook', express.raw({ type: 'application/json' }));
server.use(express.json());
server.use(express.urlencoded({ extended: true }));
3. Response Format:
// Tool call response
res.json({
results: [{
name: toolCallId,
toolCallId: toolCallId,
result: "response string"
}]
});
4. Webhook Code snippet:
// Webhook route
router.post('/webhook', async (req, res) => {
try {
const message = req.body.message || req.body;
const type = message.type || req.body.type;
if (type === 'tool-calls') {
const toolCallResult = await handleToolCall(call, message);
res.json(toolCallResult);
} else {
res.json({ success: true });
}
} catch (error) {
console.error('[Webhook] Error:', error);
res.status(500).json({ error: 'Webhook processing failed' });
}
});
// Response format
const response = {
results: [{
name: toolCallId,
toolCallId: toolCallId,
result: "response string"
}]
};
https://cdn.discordapp.com/attachments/1228667357849849856/1431152381709783093/image.png?ex=68fc6005&is=68fb0e85&hm=2691dede61b7da7c9ef77787f1beeea060d739ed16d9d4ee2c3426e716ad5cc0&