Were you able to fix this? I have a similar code using Hono ```ts app.post( '/get-alt', zVa

Were you able to fix this? I have a similar code using Hono

app.post(
    '/get-alt',
    zValidator('form', getAltSchema),
    async (c) => {
        const { image } = c.req.valid('form')

        try {
            let imageData: ArrayBuffer;
            if (image instanceof File) {
                imageData = await image.arrayBuffer();
            } else {
                const response = await fetch(image.toString());
                if (!response.ok) {
                    return c.json({ error: 'Failed to fetch image from URL' }, 400);
                }
                imageData = await response.arrayBuffer();
            }

            const imageBytes = new Uint8Array(imageData);

            try {
                const response = await c.env.AI.run('@cf/meta/llama-3.2-11b-vision-instruct', {
                    prompt: 'Create a concise alt text for this image. Use simple language and keep it under 160 characters.',
                    image: imageBytes
                });

                return c.json(response);
            } catch (error) {
                console.error('AI processing error:', error);
                return c.json({ error: 'Failed to process image with AI model' }, 500);
            }
        } catch (error) {
            console.error('Image processing error:', error);
            return c.json({ error: 'Failed to process image data' }, 500);
        }
    }
)

And each time I'm sending an image, getting this error. No matter what size I send.

AI processing error: InferenceUpstreamError: undefined: undefined

      at Ai._parseError (cloudflare-internal:ai-api:81:20)
      at async Ai.run (cloudflare-internal:ai-api:61:23)
      at null.<
Was this page helpful?