Hey, been using workflows over the
Hey, been using workflows over the weekend, it's pretty great! I have some feedback/questions please
The output that is displayed in the UI for each step is awesome. But is it possible to copy a non-truncated version of it? Also, would it be possible to mark some as secret so it's not available?
Where do the console logs go? It looks like they appear in whatever triggered the workflows but a little hard to tie it all together
Is there any advice for unit testing?
Is it possible to increase the size limit returned by each step?
Are there any limits to the code running as part of the workflows outside of a step?
Happy to go through any of this in more detail 😁
5 Replies
The output that is displayed in the UI for each step is awesome. But is it possible to copy a non-truncated version of it? Also, would it be possible to mark some as secret so it's not available?At the moment, it's not possible, but it's something we might consider to do in a near future
Where do the console logs go? It looks like they appear in whatever triggered the workflows but a little hard to tie it all togetherYou should be able to
npx wrangler tail
the script that the Workflow is implemented with. Note that, at the moment, the logs are only flushed at the end of the instance (it's a workerd limitation that is being resolved)
Is there any advice for unit testing?At the moment you probably can't run the workflow inside of unit tests (you can probably create stubs for
step.do
and step.sleep
yourself if you need to). However, you can extract the functions from the step.do
calls and test them yourself with vitest-pool-workers
Is it possible to increase the size limit returned by each step?Not at the moment, you can use R2/KV if you need bigger values and just return the key 🙂
Are there any limits to the code running as part of the workflows outside of a step?It should be deterministic, state outside of steps should be build without side-effects: https://developers.cloudflare.com/workflows/build/rules-of-workflows/
Cloudflare Docs
Rules of Workflows | Cloudflare Workflows docs
A Workflow contains one or more steps. Each step is a self-contained, individually retriable component of a Workflow. Steps may emit (optional) state that allows a Workflow to persist and continue from that step, even if a Workflow fails due to a network or infrastructure issue.
let me know if you have more questions 🙂
Amazing! Thank you so much. Hadn't thought of setting a value in KV instead of returning, really nice!
For the last question I meant more in terms of time/CPU time limits etc?
https://developers.cloudflare.com/workflows/reference/limits/ the limits are the same
Cloudflare Docs
Limits | Cloudflare Workflows docs
Limits that apply to authoring, deploying, and running Workflows are detailed below.
Great! Thank you 😁
Oh I did have one more, I'm using Honeycomb for montioring. In workers it's a try/catch/finally where the finally then sends off the events. What's the best way to do that in workflows? Can I wrap the whole run in try/catch/finally and then rethrow any errors?
@Seekerdasbatatas just wanted to check if you had any advice here, if possible please 🙏