Skip to content

Workflows not bundled on page router #143

Closed

Description

@erzr

I tried workflow on a Next.js Page Router project and ran into a couple of issues:

  1. It isn't clear the missing app directory error is coming from withWorkflow: https://github.com/vercel/workflow/blob/main/packages/cli/src/lib/builders/next-build.ts#L459-L461
  2. Workflows that might be referenced from API routes are not bundled (as observed in app/.well-known/workflow/v1/flow/route.js) unless the file name matches a pattern that app router uses: https://github.com/vercel/workflow/blob/main/packages/cli/src/lib/builders/next-build.ts#L324. Renaming the API route to route.ts resolves this issue.

Including the missing error incase it helps someone searching as well:

ReferenceError: Workflow "workflow//workflows/hmm.ts//handleUserSignup" must be a function, but got "undefined" instead

Activity

  1. pranaygp commented on Oct 30, 2025

    @pranaygp
    Contributor

    @erzr thanks for this. Yeah I believe the next builder and base builder have to be adapted for pages router format. Should be a simple fix™ - flagging in @ijjk and @adriandlam to help take a look here - unless you beat us to it

  2. pranaygp commented on Jan 16, 2026

    @pranaygp
    Contributor

    Fixed in #792

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions