JavaEar 专注于收集分享传播有价值的技术资料

lambda timed out when trying to access mongo

I wrote a simple mongo test, trying to access mongo server in a vpc. for every run I get : "errorMessage": "*** Task timed out after 3.00 seconds" I have written more handlers in the lambda just to check it.

  1. There is no problem connecting to the vpc. other handler (same file) that connects to another server runs well.
  2. There is no problem with other modules. I have added another module (make-random-string) and it's running every time.
  3. I get no error messages. No exceptions from Mongo. it just times out every time.
  4. increasing both memory to 1024 and execution time to 15s didn't help, the results are the same.
  5. Mongo driver does not require any C++ builds unless you use kerberos, which I'm not.
  6. Test file mimicking the lambda, runs fine.
  7. The sample code is here: http://pastebin.com/R2e3jwwa where the db information is removed.

Thanks.

1个回答

    最佳答案
  1. As weird as it may sound, we finally solved the problem just by changing the callback(null, response) to context.done(null, response). This nonsense took us more time than we would have liked to spend here.

    You can find more info about the issue here https://github.com/serverless/serverless/issues/1036