Skip to content

Durable chat sessions guide fails with workflow-node-module-error #243

@mrestrepoj10

Description

@mrestrepoj10

Following the "Durable chat sessions with Next.js, Workflow, and Redis" guide as written causes pnpm dev to fail during workflow bundling.

Versions:

  • chat: 4.20.1
  • @chat-adapter/slack: 4.20.1
  • @chat-adapter/state-redis: 4.20.1
  • workflow: 4.2.0-beta.70
  • next: 16.1.6

The guide imports bot into workflows/durable-chat-session.ts and uses bot.reviver() inside the workflow. With the versions above, that pulls @chat-adapter/slack into the workflow bundle and fails with:

✘ [ERROR] You are attempting to use "@chat-adapter/slack" which depends on Node.js modules. Packages that depend on Node.js modules are not available in workflow functions.

lib/bot.ts:5:9:
  5 │   slack: createSlackAdapter(),
    │          ~~~~~~~~~~~~~~~~~~
    ╵          Move this function into a step function.

Expected:

  • The docs example should work as written, or
  • The guide should mention that bot cannot be imported into the workflow module and should only be used inside "use step" functions.

Workaround:
Keep the workflow on serialized thread/message data and only import @/lib/bot inside step functions.

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