Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Getting 502 Bad Gateway Error

We are getting the following error when executing Hosted Functions app:

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.11.10</center>
</body>
</html>
Solved Solved
0 6 2,286
1 ACCEPTED SOLUTION

  1. Checked the Runtime Logs in the Edge UI and noticed the following error:
    Error: Route.get() requires a callback function but got a [object Undefined]
    at Route.(anonymous function) [as get] (/node_modules/express/lib/router/route.js:202:15)
    at Function.proto.(anonymous function) [as get] (/node_modules/express/lib/router/index.js:510:19)
    at Object.<anonymous> (/build/routes.js:19:8)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/build/app.js:8:16)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
    
  2. Fixed the code /build/app.js to ensure that the proper callback fuction was defined.

This resolved the issue.

View solution in original post

6 REPLIES 6