kubernetes-graceful-shutdown-example icon indicating copy to clipboard operation
kubernetes-graceful-shutdown-example copied to clipboard

serverDestroy always fails with error

Open fabb opened this issue 5 years ago • 1 comments

On shutdown, when serverDestroy is called, it always fails with this error:

Error happened during graceful shutdown TypeError: Cannot read property 'apply' of undefined

The problem seems to be that serverDestroy is defined like this:

const serverDestroy = promisify(server.destroy, server)

But server.destroy does not take a callback (anymore?):

destroy(error?: Error): void;

Looks like the callback was never meant to be used externally: https://github.com/nodejs/node/pull/32809

fabb avatar Sep 17 '20 08:09 fabb

Replacing server.destroy with server.close seems to work correctly.

fabb avatar Sep 17 '20 10:09 fabb