Skip to content

Plugin Load Error in Development Setup #396

@AlmostEasyGoing

Description

@AlmostEasyGoing

Describe the bug
In the development setup (i.e. using VOLUMES_PLUGINS=./.local/plugins) having no plugins, i.e. nothing the TS-Compiler copies over to dist, results in an error log during server start.

To Reproduce
Steps to reproduce the behavior:

  1. Clone this repository.
  2. Copy the .dev.env to .env.
  3. Run the server using pnpm start.
  4. Observe the
error:   ┏ Error loading plugins. +7ms
error:   ┃ [ 1] [[
error:   ┃ [ 2]   undefined
error:   ┃ [ 3] ]]
error:   ┃ [ 4] {
error:   ┃ [ 5]   context: undefined,
error:   ┃ [ 6]   error: [Error: ENOENT: no such file or directory, scandir '[...]/dist/.local/plugins'] {
error:   ┃ [ 7]     code: 'ENOENT',
error:   ┃ [ 8]     errno: -2,
error:   ┃ [ 9]     path: '[...]/dist/.local/plugins',
error:   ┃ [10]     syscall: 'scandir'
error:   ┃ [11]   },
error:   ┃ [12]   timestamp: '...'
error:   ┗ [13] }

Expected behavior
The server should start up with Found 0 plugins to load. and Loaded 0 plugins.

Additional context
If no .ts file exists anywhere in ./.local/plugins then the TS-Compiler will not create a dist/.local/plugins directory, thus the readdir(...) Operation will try to access injectDir=[...]/dist/.local/plugins and throw an Error, which leads to the fallback log.

Possible Fix
Add await mkdir(injectDir, { recursive: true }) (importing mkdir from fs-extra) after this line.

Code Understanding
Lastly while reading through the code, I was unsure whether it is intended to show injectDir as /tmp in the initial log. Is this just a placeholder?

Metadata

Metadata

Assignees

No one assigned

    Labels

    🎛️ serverThere are things to do on the server🪲 bugSomething isn't working

    Type

    No type

    Projects

    Status

    📃 New Issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions