serve v6.5.4 has UnhandledPromiseRejectionWarning and exits

Created on 9 Apr 2018  路  9Comments  路  Source: vercel/serve

Uh oh, just got this after the latest update.

  • OS: macOS 10.12.6
  • Node: v9.11.1
  • Serve: v6.5.4

Output:

$ serve
(node:79192) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'latest' of undefined
    at getMostRecent (/Users/[redacted]/.config/yarn/global/node_modules/update-check/index.js:131:32)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
(node:79192) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:79192) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process witha non-zero exit code.

Most helpful comment

Actually, I get a missing ) after argument list because of the async keyword, which is not supported in node < 8. The async/await syntax is introduced in this patch release.

node_modules/serve/bin/serve.js:83
detect(port).then(async open => {
                  ^^^^^
SyntaxError: missing ) after argument list
    at Object.exports.runInThisContext (vm.js:78:16)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:535:3

All 9 comments

The same problem.
OS: macOS 10.13.3
Node: v9.7.1
Serve: v6.5.4

(node:7) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED ***.**.**.**:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1174:14)
(node:7) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

In docker container same problem node:9.11.1-alpine .
Serve version 6.5.3 not reproduce this bug.

I have something related. It seems that node 8 is mandatory after this patch release, however the engines entry in the package.json of this project still says node 6 something and higher. It throws with promisify is not a function in node 7. Can anyone confirm?

Actually, I get a missing ) after argument list because of the async keyword, which is not supported in node < 8. The async/await syntax is introduced in this patch release.

node_modules/serve/bin/serve.js:83
detect(port).then(async open => {
                  ^^^^^
SyntaxError: missing ) after argument list
    at Object.exports.runInThisContext (vm.js:78:16)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:535:3

Same here. Downgrading to v6.5.3 fixed the problem. Thanks @NKozlov

I also downgraded, solved the issue.

I also have an issue with v6.5.4
It is occurring to me only in docker-compose environment.
Docker image is based on node:8.9.1

xxx-client_1        | (node:8) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443
xxx-client_1        | (node:8) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
production_xxx-client_1 exited with code 0

Serve version 6.5.3 not reproduce this bug.

This seems to also exist in v6.5.5

I am getting a similar issue I think.
downgrade to 6.5.3 solves the issue.

In attempting to run without external net access I was getting the following:

May  6 23:04:50 myco serve[4121]: (node:4121) UnhandledPromiseRejectionWarning: Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443
May  6 23:04:50 myco serve[4121]:     at Object._errnoException (util.js:1022:11)
May  6 23:04:50 myco serve[4121]:     at errnoException (dns.js:55:15)
May  6 23:04:50 myco serve[4121]:     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
May  6 23:04:50 myco serve[4121]: (node:4121) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
May  6 23:04:50 myco serve[4121]: (node:4121) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

As a workaround for anyone getting registry access errors (https://github.com/zeit/serve/issues/348#issuecomment-387245928, https://github.com/zeit/serve/issues/348#issuecomment-380412000, https://github.com/zeit/serve/issues/348#issuecomment-379861147), if you set NODE_ENV=production, serve should skip the update check where it's trying to grab from your currently set npm registry, per this conditional in bin/serve.js.

Was this page helpful?
0 / 5 - 0 ratings