Skip to content

ReferenceError: $$default is not defined - Workflow execution fails in Local World on Turbo monorepo #367

@waldhari1

Description

@waldhari1

Workflows fail during execution in Local World with ReferenceError: $$default is not defined when running in a Turbo monorepo environment. The workflow triggers successfully and queues successfully, but fails immediately (within 10ms) during VM context execution.

This error persists across all tested configurations including the exact setup reported as "working" in Issue #35 (workflow@4.0.1-beta.2 + next@16.0.0).

Environment
Operating System: WSL2 Ubuntu (Linux 6.6.87.2-microsoft-standard-WSL2) Node.js: v22.11.0 Package Manager: pnpm 9.15.9 Monorepo Tool: Turborepo 2.3.3 Monorepo Structure:

Shared packages: @waltoria/shared-db (Prisma), @waltoria/uuid-utils
Multiple Next.js apps in apps/ directory
Workflows in: apps/advisor-activity-nexus/workflows/
Deployment Target: Vercel (but testing locally first)

Tested Configurations (ALL FAILED)

Next.js Workflow DevKit Bundler Result

1 16.0.1 4.0.1-beta.11 Turbopack ❌ Workflow must be a function, but got "undefined"
2 16.0.1 4.0.1-beta.11 webpack ❌ $$default is not defined
3 16.0.1 4.0.1-beta.15 Turbopack ❌ Server crash: withWorkflow export not found
4 15.1.3 4.0.1-beta.11 webpack ❌ $$default is not defined
5 16.0.0 4.0.1-beta.2 Turbopack ❌ $$default is not defined
Note on Configuration #5: This is the exact configuration reported as working in Issue #35, but it fails in our monorepo environment.

Full bug report attached here as a .md file

GITHUB-ISSUE-DRAFT.md

Metadata

Metadata

Assignees

No one assigned

    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