I have workflow working locally and I

I have workflow working locally and I see the binding working on remote, but when I try to trigger it via worker I am seeing TypeError: Cannot read properties of undefined (reading 'create') c.env.COVE_WORKFLOW_VIDEO.create({ I think it is saying that the actual workflow is not bound. below is the hono api call that triggers it
.get(
"/workflow",
validator(
"query",
z.object({
videoId: z.string().min(1),
instanceId: z.string().optional(),
}),
),
describeRoute({
tags: ["Video"],
}),
async (c) => {
const organization = c.get("organization");
const { instanceId, videoId } = c.req.valid("query");

const video = await db(c.env.COVE).video.findUnique({
where: { id: videoId, organizationId: organization?.id },
});

if (!video) {
return c.json({ error: "Video not found" }, 404);
}

if (instanceId) {
const instance =
await c.env.COVE_WORKFLOW_VIDEO.get(instanceId);
return c.json({
status: await instance.status(),
});
}

// Spawn a new instance and return the ID and status
const instance = await c.env.COVE_WORKFLOW_VIDEO.create({
params: {
key: video.key,
},
});
return c.json({
id: instance.id,
details: await instance.status(),
});
},
)
.get(
"/workflow",
validator(
"query",
z.object({
videoId: z.string().min(1),
instanceId: z.string().optional(),
}),
),
describeRoute({
tags: ["Video"],
}),
async (c) => {
const organization = c.get("organization");
const { instanceId, videoId } = c.req.valid("query");

const video = await db(c.env.COVE).video.findUnique({
where: { id: videoId, organizationId: organization?.id },
});

if (!video) {
return c.json({ error: "Video not found" }, 404);
}

if (instanceId) {
const instance =
await c.env.COVE_WORKFLOW_VIDEO.get(instanceId);
return c.json({
status: await instance.status(),
});
}

// Spawn a new instance and return the ID and status
const instance = await c.env.COVE_WORKFLOW_VIDEO.create({
params: {
key: video.key,
},
});
return c.json({
id: instance.id,
details: await instance.status(),
});
},
)
9 Replies
Alex Patterson
Alex PattersonOP•4w ago
Is there another way to see if this binding is correct?
No description
Alex Patterson
Alex PattersonOP•4w ago
Also I can manually kick of the actual workflow successfully, I just can't seem to find out why the binding doesn't work in prod 😦
No description
Alex Patterson
Alex PattersonOP•4w ago
Added. I tried it as a service binding as well and both won't work once deployed. No issues local.
Alex Patterson
Alex PattersonOP•4w ago
Is this enough for that, not sure if it also has something to do with the wrangler dates?
Alex Patterson
Alex PattersonOP•4w ago
@skye sorry for the delay c46bd0f3b9ed47b8692cca098030edbf
Matt Silverlock
Matt Silverlock•4w ago
Can you show the setup of the app itself? 1. Are you passing the env into the app? Looks like Hono, so I would expect const app = new Hono<{Bindings: Env }>() 2. If you log c.env - what do you get? Log it in a middleware.
app.use("*", async (c, next) => {
console.log(Object.keys(c.env))
await next()
})
app.use("*", async (c, next) => {
console.log(Object.keys(c.env))
await next()
})
I would expect - when you upload - that you also see the bindings emitted:
$ npx wrangler@latest deploy

...
Your worker has access to the following bindings:
- Workflows:
- MY_WORKFLOW: MyWorkflow
...
$ npx wrangler@latest deploy

...
Your worker has access to the following bindings:
- Workflows:
- MY_WORKFLOW: MyWorkflow
...
Alex Patterson
Alex PattersonOP•3w ago
I am actively working on more updats so bare with me but the workflows are listed in there... COVE_WORKFLOW_VIDEO_UPLOAD_STREAM
...sensitive stuff
COVE: D1Database {
alwaysPrimarySession: D1DatabaseSessionAlwaysPrimary {
fetcher: [Fetcher],
bookmarkOrConstraint: 'first-primary'
},
fetcher: Fetcher {}
},
COVE_STORAGE_KV: KvNamespace {},
COVE_STORAGE: R2Bucket {},
COVE_WORKFLOW_VIDEO_UPLOAD_STREAM: Fetcher {},
COVE_WORKFLOW_VIDEO_TRANSCRIPT: Fetcher {}
...sensitive stuff
COVE: D1Database {
alwaysPrimarySession: D1DatabaseSessionAlwaysPrimary {
fetcher: [Fetcher],
bookmarkOrConstraint: 'first-primary'
},
fetcher: Fetcher {}
},
COVE_STORAGE_KV: KvNamespace {},
COVE_STORAGE: R2Bucket {},
COVE_WORKFLOW_VIDEO_UPLOAD_STREAM: Fetcher {},
COVE_WORKFLOW_VIDEO_TRANSCRIPT: Fetcher {}
Yes when I upload I am seeing..
Your worker has access to the following bindings:
- Workflows:
- COVE_WORKFLOW_VIDEO_UPLOAD_STREAM: WorkflowVideoUploadStream [connected to remote resource]
- COVE_WORKFLOW_VIDEO_TRANSCRIPT: WorkflowVideoTranscript [connected to remote resource]
- KV Namespaces:
- COVE_STORAGE_KV: cf70acd9efef41c3a35286e169f1c7e2 [simulated locally]
- D1 Databases:
- COVE: cove (184e56b6-5571-4882-b796-48871707f98c) [simulated locally]
- R2 Buckets:
- COVE_STORAGE: cove-storage [simulated locally]
- AI:
- Name: AI [connected to remote resource]
- Vars:
- BASE_URL: "(hidden)"
- BETTER_AUTH_SECRET: "(hidden)"
- CORS_ORIGINS: "(hidden)"
- GOOGLE_CLIENT_ID: "(hidden)"
- GOOGLE_CLIENT_SECRET: "(hidden)"
- GITHUB_CLIENT_ID: "(hidden)"
- GITHUB_CLIENT_SECRET: "(hidden)"
- ASSEMBLYAI_API_KEY: "(hidden)"
- RESEND_API_KEY: "(hidden)"
- CLOUDFLARE_API_TOKEN: "(hidden)"
- CLOUDFLARE_ACCOUNT_ID: "(hidden)"
Your worker has access to the following bindings:
- Workflows:
- COVE_WORKFLOW_VIDEO_UPLOAD_STREAM: WorkflowVideoUploadStream [connected to remote resource]
- COVE_WORKFLOW_VIDEO_TRANSCRIPT: WorkflowVideoTranscript [connected to remote resource]
- KV Namespaces:
- COVE_STORAGE_KV: cf70acd9efef41c3a35286e169f1c7e2 [simulated locally]
- D1 Databases:
- COVE: cove (184e56b6-5571-4882-b796-48871707f98c) [simulated locally]
- R2 Buckets:
- COVE_STORAGE: cove-storage [simulated locally]
- AI:
- Name: AI [connected to remote resource]
- Vars:
- BASE_URL: "(hidden)"
- BETTER_AUTH_SECRET: "(hidden)"
- CORS_ORIGINS: "(hidden)"
- GOOGLE_CLIENT_ID: "(hidden)"
- GOOGLE_CLIENT_SECRET: "(hidden)"
- GITHUB_CLIENT_ID: "(hidden)"
- GITHUB_CLIENT_SECRET: "(hidden)"
- ASSEMBLYAI_API_KEY: "(hidden)"
- RESEND_API_KEY: "(hidden)"
- CLOUDFLARE_API_TOKEN: "(hidden)"
- CLOUDFLARE_ACCOUNT_ID: "(hidden)"
Matt Silverlock
Matt Silverlock•3w ago
Your code has COVE_WORKFLOW_VIDEO but your bindings don’t show that?

Did you find this page helpful?