Cloud Functions deployment fails: "Function failed on loading user code. Error message: Code in file lib/index.js can't be loaded."

In the past, node 6 was the default target runtime. Now, node 6 has expired LTS (Long Term Support). With CLI version 6.8.0, node 6 was deprecated, and you were encouraged to target node 8 for deployment instead. Now, starting with [email protected], node 6 support is fully removed, and you must explicitly target node 8 in your package.json:

{
  // other configurations here…
  "dependencies": {
  },
  // Add an “engines” child to choose a node version, here it’s node 8.
  "engines": {
    "node": "8"
  }
}

Another related change in this version is a dependency on firebase-admin 8.x, which also drops support for node 6.

The error message itself is indicating that the keyword async isn't recognized, which is not supported by node 6.