It looks correct to me. Could it be that I'm trying to access it from an email worker?
It looks correct to me. Could it be that I'm trying to access it from an email worker?

wrangler.tomltypes.tssrc/index.ts./incoming-emails/forward-email-handler./incoming-emails/workflownpx wrangler workflows list show? Do your Workflow names match? Bindings type when you’re instantiating your Hono app instances? There are no deployed Workflows in this account. This is why I thought that you need something more than just the config in wrangler.toml for the deployment to work.[[workflows]].binding matches what I use for env.PROCESS_INCOMING_EMAILS_WORKFLOW as well as what I set on the Bindings type. And [[workflows]].class_name matches the name of my workflows class export, ProcessIncomingEmailsWorkflow.[[workflows]].name be any arbitrary name or what should that match?app.tstypes.ts
Can [[workflows]].name be any arbitrary name or what should that match?


workflows list shows nothing, you haven't registered your Workflow yet by deploying it.npm create cloudflare@latest workflows-starter -- --template "cloudflare/workflows-starter" command (apart from the empty object issue when env.MY_WORKFLOW.create() is called locally). Does this command do more than simply scaffolding the worker project on my local file system? Workflow.create was taking a whole minute. I will keep an eye when workflows get more mature.wrangler dev --remote --env stage & i have a workflow & a KV in a stage env.
Promise<InstanceStatus>

object[] instead of object;workflow.get(id).stop()) instead of terminate as a means to softly shutdown the workflow. So the user could gracefully close the workflow (for example the workflow could be a long running polling workflow that doesn't have an end state).terminate() to kill the workflow and abruptly kill the workflow in case it's stuck in a inf-loop and we want to kill it for sure.terminate is the only way to stop a long running / no end-state workflow, so it would be nice to gracefully or signal the workflow to transition to a potential end-state or cleanup.status() method (which should be fine for now) or set some outside state from inside the step callback (seems like a code smell).Maximum steps per Workflow 256, does this mean only for Workers Free? what about the limitation for Workers Paid[[workflows]]
name = "process-incoming-emails"
binding = "PROCESS_INCOMING_EMAILS_WORKFLOW"
class_name = "ProcessIncomingEmailsWorkflow"import type { Workflow } from '@cloudflare/workers-types';
export type Bindings = {
// ...other bindings
PROCESS_INCOMING_EMAILS_WORKFLOW: Workflow;
};import { app } from './app'; // Hono app
import type { Bindings } from './types';
import { handleForwardingIncomingEmails } from './incoming-emails/forward-email-handler';
export { ProcessIncomingEmailsWorkflow } from './incoming-emails/workflow';
const handler = {
fetch: app.fetch,
async email(message, env, ctx) {
await handleForwardingIncomingEmails(message, env, ctx);
},
} satisfies ExportedHandler<Bindings>;export const handleForwardingIncomingEmails = async (
message: ForwardableEmailMessage,
env: Bindings,
_ctx: ExecutionContext,
) => {
return withLogTags(
{
tags: {
handler: 'email',
requestId: crypto.randomUUID(),
},
},
async () => {
const [address] = addressParser(message.to);
if (!address?.address) {
logger.warn('No email address found in `to` field');
return message.setReject('No email address found in `to` field');
}
logger.log('Workflow defined', {
defined: !!env.PROCESS_INCOMING_EMAILS_WORKFLOW, // <-- Not defined here!
});
// await env.PROCESS_INCOMING_EMAILS_WORKFLOW.create({
// params: {
// message,
// },
// });
}
)
}export class ProcessIncomingEmailsWorkflow extends WorkflowEntrypoint<
Bindings,
Params
> {}import { createFactory } from 'hono/factory';
import { Env } from './types';
export const factory = createFactory<Env>({
initApp: (app) => {
app.use(async (c, next) => {
// Make supabase client available to all requests
const supabase = createClient(c.env.SUPABASE_URL, c.env.SUPABASE_KEY);
c.set('supabase', supabase);
await next();
});
},
});
export const app = factory.createApp();import type { Workflow } from '@cloudflare/workers-types';
export type Bindings = {
// ...other bindings
PROCESS_INCOMING_EMAILS_WORKFLOW: Workflow;
};
export type Env = {
Bindings: Bindings;
Variables: Variables;
};#:schema node_modules/wrangler/config-schema.json
name = "my-app"
compatibility_date = "2024-10-22"
compatibility_flags = ["nodejs_compat"]
main = "dist/index.js"
minify = true
upload_source_maps = true
tail_consumers = [{ service = "my-app-tail" }]
[build]
command = "pnpm run build"
[observability]
enabled = true
[ai]
binding = "AI"
[[kv_namespaces]]
binding = "INCOMING_EMAILS_KV"
id = "<redacted>"
[[kv_namespaces]]
binding = "DLQ_KV"
id = "<redacted>"
[triggers]
crons = ["* * * * *", "*/30 * * * *"]
[[queues.consumers]]
queue = "account-emails"
dead_letter_queue = "dlq"
max_batch_size = 20
max_batch_timeout = 10
max_retries = 10
[[queues.consumers]]
queue = "incoming-emails"
dead_letter_queue = "dlq"
max_batch_size = 10
max_batch_timeout = 10
max_retries = 10
[[queues.consumers]]
queue = "dlq"
[[queues.producers]]
binding = "ACCOUNT_EMAILS_QUEUE"
queue = "account-emails"
[[queues.producers]]
binding = "INCOMING_EMAILS_QUEUE"
queue = "incoming-emails"
[[workflows]]
name = "process-incoming-emails"
binding = "PROCESS_INCOMING_EMAILS_WORKFLOW"
class_name = "ProcessIncomingEmailsWorkflow"Promise<InstanceStatus>object[]objectworkflow.get(id).stop()terminate()terminate.status()Maximum steps per Workflow 256