#10457·nocobase

[Bug]: excessive false-positive warnings for virtual/custom resources in @nocobase/plugin-workflow-request-interceptor

Author: STlxx-linCreated Sep 4, 2026Updated Sep 5, 2026

* Describe the bug

When the @nocobase/plugin-workflow-request-interceptor (Workflow: Pre-action event) plugin is enabled, any API request to virtual or custom resources (e.g. /api/charts:queryData, /api/onlineCount:heartbeat, /api/loggerPro:tail) triggers excessive [warn] logs every time:

json
{"level":"warn","message":"[Workflow pre-action]: collection \"charts\" not found","module":"charts","submodule":"queryData"}

Because dashboard charts poll queries and client heartbeats report periodically, the system log file (system_YYYY-MM-DD.log) gets flooded with hundreds/thousands of these false-positive warnings, making production logs difficult to monitor and unnecessarily bloated.

Root Cause

In @nocobase/plugin-workflow-request-interceptor/dist/server/RequestInterceptionTrigger.js:

javascript
const collection = dataSource.collectionManager.getCollection(resourceName);
if (!collection) {
  context.logger.warn(`[Workflow pre-action]: collection "${resourceName}" not found`);
  return next();
}

The interceptor assumes that every action request entering the system must correspond to a physical database Collection. However, NocoBase natively supports virtual/custom resources registered via app.resource(...) (such as charts, or custom plugin API endpoints). When an action is dispatched to a custom resource without a database table collection, logging a warn is a false-positive and causes severe log pollution.

* Environment

  • NocoBase version: 2.1.x / 2.2.x (e.g. 2.1.39, 2.2.0, 2.2.5)
  • Database type and version: SQLite / MySQL / PostgreSQL
  • OS: Linux / Docker / Windows
  • Deployment Methods: Docker / Git source code
  • NodeJS version: 18.x / 20.x

* How To Reproduce

  1. Enable the @nocobase/plugin-workflow-request-interceptor plugin.
  2. Access any dashboard containing charts (triggering /api/charts:queryData), or register any custom resource via app.resource(...) and send requests to it.
  3. Check the server log (storage/logs/main/system_YYYY-MM-DD.log).
  4. You will see high-frequency warning logs: [Workflow pre-action]: collection "charts" not found.

Expected behavior

When dataSource.collectionManager.getCollection(resourceName) returns null/undefined for virtual resources, the interceptor should silently pass through (return next()) or log at debug level, rather than logging a warn alert in production.

Suggested Fix

Change the log level from warn to debug (or silently return next()):

diff
  const collection = dataSource.collectionManager.getCollection(resourceName);
  if (!collection) {
-   context.logger.warn(`[Workflow pre-action]: collection "${resourceName}" not found`);
+   context.logger.debug(`[Workflow pre-action]: collection "${resourceName}" not found`);
    return next();
  }