mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-19 23:09:09 +08:00
Nick: update extract in case there is an error
This commit is contained in:
parent
eb254547e5
commit
11af214db1
@ -34,6 +34,7 @@ export async function extractStatusController(
|
||||
success: true,
|
||||
data: data,
|
||||
status: extract.status,
|
||||
error: extract?.error ?? undefined,
|
||||
expiresAt: (await getExtractExpiry(req.params.jobId)).toISOString(),
|
||||
});
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ export type StoredExtract = {
|
||||
plan?: string;
|
||||
createdAt: number;
|
||||
status: "processing" | "completed" | "failed" | "cancelled";
|
||||
error?: any;
|
||||
};
|
||||
|
||||
export async function saveExtract(id: string, extract: StoredExtract) {
|
||||
|
@ -55,6 +55,7 @@ import { Document } from "../controllers/v1/types";
|
||||
import { performExtraction } from "../lib/extract/extraction-service";
|
||||
import { supabase_service } from "../services/supabase";
|
||||
import { normalizeUrl, normalizeUrlOnlyHostname } from "../lib/canonical-url";
|
||||
import { saveExtract, updateExtract } from "../lib/extract/extract-redis";
|
||||
|
||||
configDotenv();
|
||||
|
||||
@ -351,6 +352,11 @@ const processExtractJobInternal = async (token: string, job: Job & { id: string
|
||||
|
||||
// Move job to failed state in Redis
|
||||
await job.moveToFailed(error, token, false);
|
||||
|
||||
await updateExtract(job.data.extractId, {
|
||||
status: "failed",
|
||||
error: error.error ?? error ?? "Unknown error, please contact help@firecrawl.dev. Extract id: " + job.data.extractId,
|
||||
});
|
||||
// throw error;
|
||||
} finally {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user