Closed stefanhuber closed 7 months ago
I could create a fix by using patch-package
with the following steps:
unit-http
and patch-package
as npm dependencies: npm i unit-http patch-package --save
"postinstall": "patch-package"
under "scripts"
inside package.json
http.js
file inside node_modules/unit-http
by adding options
as the first argument to the createServer
function:
function createServer (options, requestHandler) {
return new Server(requestHandler);
}
npx patch-package unit-http
As a current workaround this is ok. Although I think this might not be a sustainable approach. The options
could be ignored in the case of our strapi deployment.
Looks like the options
argument was added in Node.js v9.6.0 (2018-02-22) / v8.12.0 (2018-09-11) in https://github.com/nodejs/node/pull/15752 and we missed it when implementing our shim for http.createServer
.
We should fix this in Unit, but the patch-package workaround should be fine for your use case until we can get a release out with a proper fix.
I tried to run strapi inside nginx unit. The startup of strapi doesn't work because of the following error:
Strapi uses
options
with thehttp.createServer
function as seen here in the source code. The node signature of thecreateServer
function looks like this:http.createServer([options][, requestListener])
. Looking at thehttp
module inside theunit-http
package thecreateServer
function is missing the options argument.Can this be solved somehow? How could strapi be started otherwise within nginx unit?
Nginx Unit has the following config.json: