2

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?

Jordan Walsh
  • 144
  • 7
  • 1
    Have you tried to increase timeout to 5 minutes? I got my problem solved with that, because I had unreliable internet connection. – elgris May 01 '17 at 17:36
  • Yes. That was 100% correct. It was a flakey connection that was dropping packets and causing the issue. Worked fine when I ran the same script at work. – Jordan Walsh May 01 '17 at 21:23
  • I tried this way: claudia create --handler lambda.handler --timeout 300. It is not working ! – Luillyfe May 24 '17 at 00:03

2 Answers2

4

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
Luillyfe
  • 6,183
  • 8
  • 36
  • 46
  • 1
    Thanks. I'll give that a go. I ended up deploying an EC2 instance in Sydney and installed git and Claudia there. Then after I've tested locally I check in to git. Log in to the remote terminal and run Claudia update from there. Has worked fine so far. Still not sure why my home internet has this issue. – Jordan Walsh May 24 '17 at 09:36
1

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

kimy82
  • 4,069
  • 1
  • 22
  • 25