diff --git a/src/index.ts b/src/index.ts index 047974a..29dccc6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -806,9 +806,11 @@ async function handleRecommend( return jsonResponse(response, 200, corsHeaders); } catch (error) { console.error('[Recommend] Error:', error); + console.error('[Recommend] Error stack:', error instanceof Error ? error.stack : 'No stack'); return jsonResponse( { error: 'Failed to generate recommendations', + details: error instanceof Error ? error.message : 'Unknown error', request_id: requestId, }, 500, @@ -1634,9 +1636,11 @@ The option with the LOWEST TOTAL MONTHLY COST (including bandwidth) should have const response = openaiResult.choices[0]?.message?.content || ''; console.log('[AI] Response received from OpenAI, length:', response.length); + console.log('[AI] Raw response preview:', response.substring(0, 500)); // Parse AI response const aiResult = parseAIResponse(response); + console.log('[AI] Parsed recommendations count:', aiResult.recommendations.length); // Pre-index VPS benchmarks by provider for O(1) lookups const vpsByProvider = new Map();