WIP - fix twilio functionality now that we use BFF
This commit is contained in:
@@ -22,6 +22,8 @@ export default defineEventHandler(async (event) => {
|
||||
const queryString = new URLSearchParams(query as Record<string, string>).toString()
|
||||
const fullUrl = `${backendUrl}/api/${path}${queryString ? `?${queryString}` : ''}`
|
||||
|
||||
console.log(`[BFF Proxy] ${method} ${fullUrl} (subdomain: ${subdomain}, hasToken: ${!!token})`)
|
||||
|
||||
// Build headers to forward
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': getHeader(event, 'content-type') || 'application/json',
|
||||
@@ -74,8 +76,14 @@ export default defineEventHandler(async (event) => {
|
||||
errorMessage = errorData.message || errorMessage
|
||||
} catch {
|
||||
// Response wasn't JSON
|
||||
try {
|
||||
const text = await response.text()
|
||||
console.error(`[BFF Proxy] Backend error (non-JSON): ${text}`)
|
||||
} catch {}
|
||||
}
|
||||
|
||||
console.error(`[BFF Proxy] Backend returned ${response.status}: ${errorMessage}`, errorData)
|
||||
|
||||
throw createError({
|
||||
statusCode: response.status,
|
||||
statusMessage: errorMessage,
|
||||
|
||||
Reference in New Issue
Block a user