garff
garff
CDCloudflare Developers
Created by garff on 1/27/2025 in #workers-help
Hono and an empty env variable
I'm trying to run an worker ai using hono. This is my index file: import { fromHono } from 'chanfana'; import { Hono } from 'hono'; import { EmbeddingCreate } from 'endpoints/embeddingCreate'; import { EmbeddingFetch } from 'endpoints/embeddingFetch'; const app = new Hono(); const openapi = fromHono(app, { docs_url: '/', }); // Endpoints openapi.get('/api/embeddings/:text/:distance', EmbeddingFetch); openapi.post('/api/embeddings/:text', EmbeddingCreate); export default app; And this is my wrangler file: name = "worker-test" main = "src/index.ts" compatibility_date = "2024-01-10" [[vectorize]] binding = "VECTORIZE" index_name = "findu-job-desc-test1" [ai] binding = "AI" And my handle function looks like this: async handle(c) { const data = await this.getValidatedData<typeof this.schema>(); const embeddingToCreate = data.body; try { const response: EmbeddingResponse = await c.env.ai.run('@cf/baai/bge-base-en-v1.5', { text: embeddingToCreate.text, }); return { success: true, embedding: { text: embeddingToCreate.text, embedding: response.data, }, }; } catch (error) { console.error(error); } } The c.env is empty and the c.env.AI.run is undefined. What am I missing?
3 replies
CDCloudflare Developers
Created by garff on 1/25/2025 in #workers-help
How are the pricing on workers calculated?
Is it more expensive to use one worker for 10 seconds than using 10 workers for 1 second?
3 replies
CDCloudflare Developers
Created by garff on 1/25/2025 in #general-help
Resetting password
Trying to reset password but I'm getting: API Request Failed: post https://dash.cloudflare.com/api/v4/forgot-password (429) Now what?
4 replies