Skip to content

[Bug]: the published package cannot restore a Feishu channel — the SDK it dynamic-imports is never installed #43

Closed

Description

@antianqi

The published package cannot restore a Feishu (Lark) channel, because the SDK it reaches for is never installed.

Installed 0.1.8 into a fresh data directory and started it:

ERROR Feishu WS restore failed {"err":{"type":"Error","message":"Cannot find package '@larksuiteoapi/node-sdk' imported from .../server/runtime.js","code":"ERR_MODULE_NOT_FOUND"}}
ERROR Channel inbound loop restore failed ... same

The package's manifest declares:

dependencies:         better-sqlite3 12.11.1, node-pty 1.1.0
optionalDependencies: bufferutil ^4.0.1, utf-8-validate >=5.0.2

@larksuiteoapi/node-sdk is a dependency of packages/local-runtime (^1.60.0), and the packaged server/runtime.js reaches it through a dynamic import, so the bundler left it external. Nothing installs it: the package ships no node_modules of its own, and the two native modules it does declare are the only things npm puts on disk.

Running the same code from the repository works, because the workspace resolves packages/local-runtime's dependencies. The published package does not, so the two forms are not equivalent. A Feishu channel that was bound in the shared data directory is loaded on every start and then fails to connect, and the WebUI's "接入 IM" feature cannot be used at all from an npm install.

Two ways to close it:

  • Declare it as an optional dependency of the package, so npm installs it when the channel is wanted and the startup stays cheap when it is not. The dynamic import already treats it as optional; the manifest does not.
  • Or bundle it.

The failure is quiet by design — the import is caught so that startup continues — which is what makes it easy to miss: the service comes up, the channel is listed in the data directory, and it never connects.

Activity

  1. added
    bug
    on Nov 14, 2026
  2. Fectivnfy112357 commented on Nov 20, 2026

    @Fectivnfy112357
    Contributor

    Reproduced ERR_MODULE_NOT_FOUND in an isolated npm install. PR #50 declares the Feishu SDK and verifies that the installed server can load WSClient and EventDispatcher. The package installation and real runtime startup checks pass. Closing as addressed by the submitted PR. The fix reaches npm users after merge and publication of a new version. Live Feishu reconnection was not tested.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions