Fix chat endpoint - use text() instead of json()

- wws Response object may not have json() method
- Parse response manually with JSON.parse

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-15 06:05:30 +01:00
parent 838cac2bbf
commit 97dbd958cc

View File

@@ -45,7 +45,14 @@ const handler = async (request) => {
}) })
}) })
const result = await n8nResponse.json() // Use text() and parse manually (json() may not be available in wws)
const responseText = await n8nResponse.text()
let result
try {
result = JSON.parse(responseText)
} catch (e) {
result = { text: responseText }
}
let response = new Response(JSON.stringify({ let response = new Response(JSON.stringify({
success: true, success: true,