Skip to content

@workflow/world-postgres: ERR_REQUIRE_ESM with Next.js 15 #812

@rajaraodv

Description

@rajaraodv

Description

When using @workflow/world-postgres with Next.js 15, the app fails with an ES Module error when trying to start a workflow via workflow/api.

Error

Error: require() of ES Module @workflow/world-postgres/dist/index.js not supported.
Instead change the require() to a dynamic import() which is available in all CommonJS modules.

Environment

  • Next.js: 15.5.9
  • workflow: 4.0.1-beta.48
  • @workflow/world-postgres: 4.1.0-beta.28
  • Node.js: 20.x

Steps to Reproduce

  1. Create a Next.js 15 app with withWorkflow in next.config.ts
  2. Install workflow and @workflow/world-postgres
  3. Create an API route that imports from workflow/api:
    import { start } from "workflow/api";

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