ImJustARobot
ImJustARobot
CDCloudflare Developers
Created by ImJustARobot on 11/22/2023 in #general-help
InferenceUpstreamError: ERROR 3001: Unknown internal error
Hi guys, using the Whisper model I got this error: "Error processing request: InferenceUpstreamError: ERROR 3001: Unknown internal error" Also, this is my code using workers: import { Ai } from "@cloudflare/ai"; export interface Env { AI: any; } export default { async fetch(request: Request, env: Env) { try { if (request.method !== "POST") { console.error("Non-POST request received"); return new Response("Expected a POST request with audio data", { status: 400 }); } const audioData = await request.arrayBuffer(); if (!audioData) { console.error("No audio data found in request"); return new Response("No audio data found in request", { status: 400 }); } console.log(Received audio data: ${audioData.byteLength} bytes); const ai = new Ai(env.AI); const input = { audio: [...new Uint8Array(audioData)], }; console.log("Sending audio data to AI model for processing"); const response = await ai.run("@cf/openai/whisper", input); console.log("AI model processing completed"); return new Response(JSON.stringify({ transcript: response }), { headers: { 'Content-Type': 'application/json' }, }); } catch (error) { console.error("Error occurred in the worker:", error); // Additional logging for debugging if (error instanceof Error) { console.log("Error details:", error.message, error.name, error.stack); } else { console.log("Non-standard error object received"); } return new Response(Error processing request: ${error}, { status: 500 }); } } }
2 replies