For the moment, we do not support `waitForEvent` steps or events as entrypoint (focus on the "for th

For the moment, we do not support waitForEvent steps or events as entrypoint (focus on the "for the moment" 😉 ). One way you could achieve the intended behaviour, would be store the humam action in a KV or D1, and periodically check for that action, sleeping between checks
15 Replies
nclevenger
nclevenger•3w ago
I was just experimenting with this myself - I was about to try opening a websocket to the Slack API in Socket Mode and try to wrap the onmessage handler with a promise that could be awaited in the step https://api.slack.com/apis/socket-mode
Slack API
Socket Mode
How to use Socket Mode with SDKs.
Diogo Ferreira
Diogo FerreiraOP•3w ago
That approach should work. The for loop should be outside the step, that way you will benefit from the persistancy of previous successful step executions, sparing on the API calls. Recommendation. Give it a spin!
Gyurmatag
Gyurmatag•3w ago
Okay, Thank you! But What about the maximum 256 steps? I will definitely have more than that. Does the paid tier have limits regarding the steps?
i40west
i40west•3w ago
What is the function passed to step.do supposed to return? If I return anything at all from it, it causes the workflow to throw an exception after finishing successfully, every time, and I can't figure out what I'm doing wrong
myconull
myconull•3w ago
Hello, I'm really excited to try Workflows. I tried to add a Workflow to a Remix application. I used the Remix example Framework guide in the Pages docs. Got this error on wrangler deploy:
[ERROR] Your Worker depends on the following Workflows, which are not exported in your entrypoint file: DemgEventWorkflow.

You should export these objects from your entrypoint, build/worker/index.js
[ERROR] Your Worker depends on the following Workflows, which are not exported in your entrypoint file: DemgEventWorkflow.

You should export these objects from your entrypoint, build/worker/index.js
Any ideas on how to fix are appreciated! My worker is built in a functions/[[path]].ts file that looks like:
import { createPagesFunctionHandler } from "@remix-run/cloudflare-pages";

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - the server build file is generated by `remix vite:build`
// eslint-disable-next-line import/no-unresolved
import * as build from "../build/server";

export const onRequest = createPagesFunctionHandler({ build });
import { createPagesFunctionHandler } from "@remix-run/cloudflare-pages";

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - the server build file is generated by `remix vite:build`
// eslint-disable-next-line import/no-unresolved
import * as build from "../build/server";

export const onRequest = createPagesFunctionHandler({ build });
myconull
myconull•3w ago
Cloudflare Docs
Remix | Cloudflare Workers docs
Create a Remix application and deploy it to Cloudflare Workers with Workers Assets.
DiamondDragon
DiamondDragon•3w ago
noticing if you have a long output in the trace online it will go off screen (copy button disappears)
No description
DiamondDragon
DiamondDragon•3w ago
also, maybe I missed it, but I haven't figured out how to run a workflow that's been modified locally, as opposed to the one already deployed. Is this where we're at with the beta or did i miss how to?
Unknown User
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Cayter
Cayter•3w ago
1. Remix with Vite currently relies on Wrangler's getPlatformProxy() that uses miniflare under the hood. This setup means Remix is running on Node.js and accessing the Env through HTTP getPlatformProxy(). 2. By following this PR, you can leverage more features specifically designed for Cloudflare Workers, remix with cloudflare pages will have bumpy journey ahead 3. Run the following commands to set up your development environment: - remix vite:dev on port 3000 - wrangler dev --define "process.env.NODE_ENV:'production'" --log-level=info --port=3001 --test-scheduled app/worker.ts Note: worker.ts should be ESM-based for Cloudflare Workers. wrangler dev enables you to develop queues, crons, and workflows within workerd environment instead of NodeJS. the error you're encountering is because getPlatformProxy() doesn’t work with workflows. If you have [[workflows]] in wrangler.toml, Miniflare will refer to it, resulting in the error the development experience for a Vite-powered app has limitations, especially with newer features. This should improve once Vite v6 is released, and Wrangler is updated to support it
elithrar
elithrar•3w ago
You will need to deploy a Worker with your Workflow; you can’t bundle it into your Pages (Remix) app.
DiamondDragon
DiamondDragon•3w ago
I'm getting a Type instantiation is excessively deep and possibly infinite. in a step. I don't think it's a very complex type being returned
No description
Diogo Ferreira
Diogo FerreiraOP•3w ago
Thanks for reporting it!
Avi
Avi•3w ago
is there support for scheduling a workflow to run periodically, like a cron job? or would I use a worker with a cron trigger to initiate a workflow? oh the docs address this, yes, nvm ok in that case
Jacob
Jacob•3w ago
If you want to run it more often than once a minute, you could have your workflow schedule its next run rather than an external trigger. Would just need to jump-start it initially
Want results from more Discord servers?
Add your server