Workflows only allow you to keep state that’s returned from steps. Any call to a Durable Object (or

Workflows only allow you to keep state that’s returned from steps. Any call to a Durable Object (or other async call) has to happen inside a step.do(), otherwise even if it works locally in wrangler dev it fails in production.

Here’s the corrected version:
const portalResponse = await step.do('get-portal-response', async () => {
  const portal = this.env.PORTAL.getByName(portalIdString);
  return await portal.test();
});

You can read more here: https://developers.cloudflare.com/workflows/build/rules-of-workflows/
Cloudflare 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.
Was this page helpful?