phusion / passenger

A fast and robust web server and application server for Ruby, Python and Node.js
https://www.phusionpassenger.com/
MIT License
5.01k stars 548 forks source link

Passenger throws circular dependency warning in node 14.15.5 LTS #2341

Open grahamb opened 3 years ago

grahamb commented 3 years ago

Issue report

Fill in as much as possible so that we can understand, find and fix the problem.

Question 1: What is the problem?

When serving a NodeJS app using the latest Node LTS (14.15.5) and latest Passenger (6.0.7) with Apache HTTPD, Passenger logs a warning when the app is started:

App 84033 output: (node:84033) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
App 84033 output:     at emitCircularRequireWarning (internal/modules/cjs/loader.js:650:11)
App 84033 output:     at Object.get (internal/modules/cjs/loader.js:664:5)
App 84033 output:     at Object.exports.setLevels (/usr/share/passenger/node/vendor-copy/winston/lib/winston/common.js:35:14)
App 84033 output:     at Object.<anonymous> (/usr/share/passenger/node/vendor-copy/winston/lib/winston.js:84:8)
App 84033 output:     at Module._compile (internal/modules/cjs/loader.js:1063:30)
App 84033 output:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
App 84033 output:     at Module.load (internal/modules/cjs/loader.js:928:32)
App 84033 output:     at Function.Module._load (internal/modules/cjs/loader.js:769:14)
App 84033 output:     at Module.require (internal/modules/cjs/loader.js:952:19)
App 84033 output:     at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)

I don't have winston in my project, and this stack trace appears to be coming from passenger, not my app.

Question 2: Passenger version and integration mode:

Passenger OSS 6.0.7, Apache HTTPD 2.4

Question 3: OS or Linux distro, platform (including version):

RHEL7

Question 4: Passenger installation method:

Your answer: [ ] RubyGems + Gemfile [ ] RubyGems, no Gemfile [ ] Phusion APT repo [x] Phusion YUM repo [ ] OS X Homebrew [ ] source tarball [ ] Other, please specify:

Question 5: Your app's programming language (including any version managers) and framework (including versions):

Node 14.15.5 LTS

Question 6: Are you using a PaaS and/or containerization? If so which one?

No

Kuzzy commented 3 years ago

Hello, I have the same problem on startup!

OS: Ubuntu 16.04.5 LTS (no Docker or Kubernetes, just simple VM on DO ) Passenger: 6.0.10 NodeJs: 14.17.4

Log output:

(node:28015) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:674:11)
    at Object.get (internal/modules/cjs/loader.js:688:5)
    at Object.exports.setLevels (/usr/share/passenger/node/vendor-copy/winston/lib/winston/common.js:35:14)
    at Object.<anonymous> (/usr/share/passenger/node/vendor-copy/winston/lib/winston.js:84:8)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)

If look into usr/share/passenger/node/vendor-copy/winston/package.json it's possible to see that it's 1.1.2 version of winston used, which is incompatible with nodejs v14+. Winston should be v3+ to work normally with nodejs v14+. I'm not sure how Passenger use winston and if it possible to just update this winston version to newer?

distalx commented 2 years ago

+1

Started running into the same issue after updating the node version to 14.18.2. Passenger version is 6.0.12

App 22612 output: (node:22612) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
App 22612 output:     at emitCircularRequireWarning (internal/modules/cjs/loader.js:675:11)
App 22612 output:     at Object.get (internal/modules/cjs/loader.js:689:5)
App 22612 output:     at Object.exports.setLevels (/usr/share/passenger/node/vendor-copy/winston/lib/winston/common.js:35:14)
App 22612 output:     at Object.<anonymous> (/usr/share/passenger/node/vendor-copy/winston/lib/winston.js:84:8)
App 22612 output:     at Module._compile (internal/modules/cjs/loader.js:1085:14)
App 22612 output:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
App 22612 output:     at Module.load (internal/modules/cjs/loader.js:950:32)
App 22612 output:     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
App 22612 output:     at Module.require (internal/modules/cjs/loader.js:974:19)
App 22612 output:     at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)
distalx commented 2 years ago

Hi @FooBarWidget & @CamJN.

How do you think this should be resolved? Should we update the Winston to its latest version which is 3.6.0 ATM?

CamJN commented 2 years ago

https://github.com/phusion/passenger/commit/98d31cbcfdda7cb880c2e7c4ced4f9cf02399708 https://github.com/phusion/passenger/commit/503f190f997fe8bc343bea269614cf7649cad88c

distalx commented 2 years ago

Thank you @CamJN, I have just done a fresh setup and this issue has been resolved for me in version 6.0.13.