Claudia.js NetworkingError creating Lambda Function - Times out after 120000ms

944 Views Asked by At

I've built a bot using the claudia.js claudia-bot-builder and all was working fine until I tried to push an update this morning. Now the script is timing out.

Script

claudia create --region ap-southeast-2 --api-module index --profile xero-messenger-bot

Error

creating Lambda lambda.createFunction   FunctionName=my-bot
{TimeoutError: Connection timed out after 120000ms
    at ClientRequest.<anonymous> 
(/usr/local/lib/node_modules/claudia/node_modules/aws-sdk/lib/http/node.js:83:34)
    at Object.onceWrapper (events.js:291:19)
    at emitNone (events.js:86:13)
    at ClientRequest.emit (events.js:186:7)
    at TLSSocket.emitTimeout (_http_client.js:679:10)
    at Object.onceWrapper (events.js:291:19)
    at emitNone (events.js:86:13)
    at TLSSocket.emit (events.js:186:7)
    at TLSSocket.Socket._onTimeout (net.js:342:8)
    at ontimeout (timers.js:365:14)
  message: 'Connection timed out after 120000ms',
  code: 'NetworkingError',
  time: 2017-04-20T05:48:18.230Z,
  region: 'ap-southeast-2',
  hostname: 'lambda.ap-southeast-2.amazonaws.com',
  retryable: true 
}

I've tried a few different regions (ap-southeast-1, us-east-2 etc) but they all seem to throw the same error.

I'd think it was my code, but this same script was working yesterday, so I'm not sure why it isn't today.

Any ideas where to check for more information?

2

There are 2 best solutions below

1
Luillyfe On

After too much searching about I stop by Gitter's Claudia's. @stojanovic suggest to me that I should use --use-s3-bucket flag.

claudia create --handler lambda.handler --use-s3-bucket your-bucket-name --deploy-proxy-api --region us-east-1
0
kimy82 On

I know it is an old post but a quick nasty fix can be just going to NPM global claudia package and edit the following file _~\node_modules\claudia\node_modules\aws-sdk\lib\http\node.js_ and add the timeout that works for you:

...
AWS.NodeHttpClient = AWS.util.inherit({
  handleRequest: function handleRequest(httpRequest, httpOptions, callback, errCallback) {
      httpOptions.timeout = xxxxx (default to 120000);
...

Hope that helps