Skip to content

[BUG] Every document command prints four node-config WARNING lines before its output #2323

Closed

Description

@Azizzzss

Describe the bug.

Every CLI command that loads an AsyncAPI document (validate, convert, generate, bundle, diff, ...) prints four warning lines from the config npm package before its real output:

WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
WARNING: See https://github.com/node-config/node-config/wiki/Strict-Mode
WARNING: No configurations found in configuration directory:C:\Users\me\my-project\config
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.

They go to stderr, so piping still works, but every user sees them on every run. The last line even asks the user to set an environment variable to silence a tool they did not configure.

Cause (checked in the installed package and on master):

  • bin/run_bin (the binary installed from npm) sets process.env.NODE_ENV = 'production'.
  • src/utils/logger.ts does import config from 'config' and calls config.has('log.dir') at import time to build a logDir and create it with mkdirSync.
  • The config package looks for a config/ folder in the user's current working directory. The CLI does not ship one. Only the API server sets NODE_CONFIG_DIR before importing (src/apps/api/server.ts, src/apps/cli/commands/start/api.ts).
  • logger.ts is imported by src/domains/models/SpecificationFile.ts, so every document command triggers it.
  • The winston logger in logger.ts only has a Console transport. logDir is created but never used by any transport, and nothing else in src/ reads it.

Introduced by #1825 (service-based refactor), first shipped in v3.3.0. The same lines appear in the logs attached to #2293, which is about the mkdirSync of this unused folder.

Expected behavior

Only the command's own output is printed.

Screenshots

$ asyncapi validate asyncapi.yaml
WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
WARNING: See https://github.com/node-config/node-config/wiki/Strict-Mode
WARNING: No configurations found in configuration directory:C:\Users\me\my-project\config
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.

File asyncapi.yaml is valid but has (itself and/or referenced documents) governance issues.
...

How to Reproduce

npm install @asyncapi/[email protected]
npx asyncapi validate asyncapi.yaml

Any directory without a config/ folder reproduces it.

🖥️ Device Information [optional]

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes. Proposed fix: remove the unused logDir block (the config import, the path.join and the mkdirSync) from src/utils/logger.ts, since no transport writes to it. That removes the warnings and also the mkdirSync race from #2293 (which #2294 patches with recursive: true). If maintainers prefer to keep the directory, the smaller change is to only require('config') when NODE_CONFIG_DIR is set, which I have tested locally: the warnings disappear and the API server path still reads log.dir.

Activity

  1. github-actions commented on Oct 15, 2026

    @github-actions
    Contributor

    Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
    Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

  2. added a commit that references this issue on Oct 20, 2026
    e0e3d97
  3. moved this from To Triage to Done in CLI - Kanbanon Oct 29, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions