i40west
i40west
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
oh lol
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
Maybe that's why other people weren't reporting this; no one is enabling logs because it's a paid feature :lul:
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
Thanks 🙂
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
Billing not a concern 🙂
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
Yeah, my workflow is an update of my Worker that takes webhooks from Cloudflare health checks, hits the CF API, then hits the PagerDuty api. It only gets invoked when my personal servers go down, which they basically never do :lul:
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
So, maybe safe to just ignore it since the code actually works?
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
oh, those bugs are the BEST :lul:
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
That's the mysterious thing. I had a "real" workflow that actually did stuff, and it worked perfectly, then threw this exception, so I kept digging for what I was doing wrong.
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
That's from the real-time log. The entry from the regular Observability log omits the console messages but has the rest of the same stuff.
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
No description
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
Okay, that didn't fix it.
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
Wait, so returning something from run() is mandatory? Knowing that would have saved me two days of frustration :lul:
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
This logs an exception after my code runs to completion ('workflow complete' is logged). If I remove the return from the step.do function, there is no exception. The exception is logged with no error message and can't be caught with try/catch. Since other people aren't reporting this, clearly I'm missing something fundamental.
32 replies
CDCloudflare Developers
Created by i40west on 10/29/2024 in #workflows-beta
What is the function passed to `step.do`
import { WorkflowEntrypoint } from 'cloudflare:workers';

export class MyWorkflow extends WorkflowEntrypoint {
async run(event, step) {

const one = await step.do('first step', async () => {
console.info('first step');
return { foo: 'bar' };
});

await step.do('second step', async () => {
console.info('second step');
});

console.info('workflow complete');
}
}

export default {
async fetch(req, env) {
const instance = await env.MY_WORKFLOW.create();
const status = await instance.status();
console.info('created workflow:', instance.id, status);
return Response.json({
id: instance.id,
details: status,
});
}
}
import { WorkflowEntrypoint } from 'cloudflare:workers';

export class MyWorkflow extends WorkflowEntrypoint {
async run(event, step) {

const one = await step.do('first step', async () => {
console.info('first step');
return { foo: 'bar' };
});

await step.do('second step', async () => {
console.info('second step');
});

console.info('workflow complete');
}
}

export default {
async fetch(req, env) {
const instance = await env.MY_WORKFLOW.create();
const status = await instance.status();
console.info('created workflow:', instance.id, status);
return Response.json({
id: instance.id,
details: status,
});
}
}
32 replies
CDCloudflare Developers
Created by Martial on 10/1/2024 in #pages-help
Bindings depending on the environment
This should work just how you have it, [[env.preview.d1_databases]]. Checking my own code, I have the database_id field in both binding sections as well as database_name, so maybe that is necessary? I do use the same binding name for both environments, with a different name and id, and it works as expected.
2 replies