Ardakilic / alerthub

AlertHub is a simple tool written with NodeJS to get alerted from new GitHub and GitLab repository events.
MIT License
200 stars 12 forks source link

Getting "ERR_UNSUPPORTED_DIR_IMPORT" when running Alerthub via Docker image #70

Closed mtnezm closed 1 year ago

mtnezm commented 1 year ago

Hello,

When running Alerthub via Docker as per documentation:

docker run --name alerthub -d -v /host/path/config.js:/usr/src/app/etc/config.js -p 3444:3444 ghcr.io/ardakilic/alerthub:2

The container immediately exits after its creation. Container logs are showing this:

node:internal/errors:484
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/usr/src/app/etc/config.js' is not supported resolving ES modules imported from /usr/src/app/src/index.mjs
    at new NodeError (node:internal/errors:393:5)
    at finalizeResolution (node:internal/modules/esm/resolve:301:17)
    at moduleResolve (node:internal/modules/esm/resolve:866:10)
    at defaultResolve (node:internal/modules/esm/resolve:1074:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:425:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_UNSUPPORTED_DIR_IMPORT',
  url: 'file:///usr/src/app/etc/config.js'
}

Node.js v18.9.1
mtnezm commented 1 year ago

Forgot to mention that of course source file path (/host/path/config.js) had been updated accordingly, still same error.

mtnezm commented 1 year ago

Nevermind, I managed to fix it. My environment is Kubernetes and all it took was to double check that the configMap path reference matches everywhere else. Apologies.