Spaces:
Running
Running
Commit
·
c18e598
1
Parent(s):
4a06718
investigating
Browse files
src/app/api/v1/export/route.ts
CHANGED
@@ -28,9 +28,27 @@ export async function POST(req: NextRequest, res: NextResponse) {
|
|
28 |
{ method: "POST", body: await req.blob() }
|
29 |
)
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
|
34 |
|
35 |
return new NextResponse(blob, {
|
36 |
status: 200,
|
|
|
28 |
{ method: "POST", body: await req.blob() }
|
29 |
)
|
30 |
|
31 |
+
console.log(`[api/v1/export] API responded: ${result.status} ${result.statusText}`)
|
32 |
+
|
33 |
+
if (result.status !== 200) {
|
34 |
+
let errorMessage = "unknown 500 error"
|
35 |
+
try {
|
36 |
+
let resp = await req.json()
|
37 |
+
if (resp?.error) {
|
38 |
+
errorMessage = resp?.error
|
39 |
+
}
|
40 |
+
} catch (err) {}
|
41 |
+
|
42 |
+
console.log(`[api/v1/export] failed to generate the video (${errorMessage})`)
|
43 |
+
|
44 |
+
return NextResponse.json({
|
45 |
+
"error": errorMessage
|
46 |
+
}, {
|
47 |
+
status: 500,
|
48 |
+
})
|
49 |
+
}
|
50 |
|
51 |
+
const blob = await result.blob()
|
52 |
|
53 |
return new NextResponse(blob, {
|
54 |
status: 200,
|