Logs of the Workflow can be found in the console under the Workflow tab

It has two modes that can be changed from to top right corner:

  • Grouped By Workflow Run Id : This is the default view where the overall workflow run is summarized. You can see each step, its start date and output and also whether it is succesfully delivered or not.
  • Flat View : The flat view is mostly for debugging when a workflow step has failed. It has more details about individual events of each step.

We have 4 new event types introduced on top of existing message events. Note that message events are relavent for individual steps. The new 4 events are to show the state of a workflow run.

  • RUN_STARTED
  • RUN_FAILED
  • RUN_CANCELLED
  • RUN_SUCCESS

Here is an example route implementation with our SDK and its corresponding screenshot from Workflow tab showing its events.

import { serve } from "@upstash/workflow/nextjs";
import { retrieveEmail, fetchFromLLm, UserRequest} from "../../../lib/util";


export const { POST } = serve<UserRequest>(
  async (context) => {
    const input = context.requestPayload;

    await context.sleep("sleep", 10);

    const p1 = context.run("retrieveEmail", async () => {
      return retrieveEmail(input.id);
    });

    const p2 = context.run("askllm", async () => {
      return fetchFromLLm(input.question);
    });

    await Promise.all([p1, p2])
  },
);

We are calling this endpoint as follows:

curl -XPOST https://qstash-workflow.vercel.app/api/example -d '{"id": "id_123", "question": "what is the meaning of life?"}'

Steps of the related workflow runs look as follows:

Here is another run where fetchFromLLm is throwing an error. When a particular step is retrying/failed, you can click it to see more details as shown below:

While a step is retrying, it is composed of several messages. You can click the messageId field above to see all the events of a particular step to find out why it is retrying or failed. When clicked, the workflow events will switch to flat view with messageId filtered as shown below:

In this screen, you can go to one of the error events, and see what response it returned to understand the details of the error as shown below: