fix: Rename api function to match endpoint URL

This commit is contained in:
2026-01-02 15:44:54 +01:00
parent 1182a858a9
commit 0f7f9e88d9
2 changed files with 7 additions and 15 deletions

View File

@@ -1,5 +1,4 @@
import type { VercelRequest, VercelResponse } from '@vercel/node' import type { VercelRequest, VercelResponse } from '@vercel/node';
import express from 'express'
// In-memory rate limiting for error reporting // In-memory rate limiting for error reporting
const rateLimitMap = new Map<string, { count: number; resetTime: number }>() const rateLimitMap = new Map<string, { count: number; resetTime: number }>()
@@ -76,10 +75,10 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
if (payload.stack) { if (payload.stack) {
const stackLines = String(payload.stack).split('\n').slice(0, 15).join('\n') const stackLines = String(payload.stack).split('\n').slice(0, 15).join('\n')
embed.fields.push({ embed.fields.push({
name: 'Stack Trace', name: 'Stack Trace',
value: `\`\`\`\n${stackLines.slice(0, 1000)}\n\`\`\``, value: `\`\`\`\n${stackLines.slice(0, 1000)}\n\`\`\``,
inline: false inline: false
}) })
} }
@@ -96,7 +95,7 @@ export default async function handler(req: VercelRequest, res: VercelResponse) {
} catch (error) { } catch (error) {
console.error('[ErrorReporting] Failed:', error) console.error('[ErrorReporting] Failed:', error)
return res.status(500).json({ return res.status(500).json({
error: 'Failed to send error report', error: 'Failed to send error report',
message: error instanceof Error ? error.message : 'Unknown error' message: error instanceof Error ? error.message : 'Unknown error'
}) })

View File

@@ -1,8 +1 @@
{ {}
"rewrites": [
{
"source": "/api/report-error",
"destination": "/api"
}
]
}