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:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user