What is the function passed to `step.do` supposed to return? If I return anything at all from it, it

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
12 Replies
myconull
myconull2mo 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
myconull2mo ago
Cloudflare Docs
Remix | Cloudflare Workers docs
Create a Remix application and deploy it to Cloudflare Workers with Workers Assets.
DiamondDragon
DiamondDragon2mo ago
noticing if you have a long output in the trace online it will go off screen (copy button disappears)
No description
DiamondDragon
DiamondDragon2mo 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 User2mo ago
Message Not Public
Sign In & Join Server To View
Cayter
Cayter2mo 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
elithrar2mo ago
You will need to deploy a Worker with your Workflow; you can’t bundle it into your Pages (Remix) app.
DiamondDragon
DiamondDragon2mo 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 Ferreira2mo ago
Thanks for reporting it!
Avi
Avi2mo 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
Jacob2mo 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
Avi
Avi2mo ago
what does the workflow concurrency limit mean? does that mean that if I have 5k scheduled, 100 will be initally scheduled to run, and as they conplete,m ore will be scheduled? basically 100 max parallelism? my usecase is that i'd like to run code every night at midnight, and id love to NOT have to create a separate cloudflare worker with a scheduled handler for this just one instance of that code
Want results from more Discord servers?
Add your server