assertible / lambda-cloudwatch-slack

Send AWS CloudWatch notifications to a Slack channel using Lambda
https://assertible.com/blog/npm-package-lambda-cloudwatch-slack
MIT License
482 stars 249 forks source link

AWS Deploy hangs and then times out #32

Open gokeji opened 5 years ago

gokeji commented 5 years ago

When I do npm run deploy, this is what I get in the terminal. The lambda upload function doesn't complete, and later fails with a timeout. Does anyone have any clues as to why this is happening? Thanks!

=> Running npm install --production
=> Zipping deployment package
=> Zipping repo. This might take up to 30 seconds
=> Reading zip file to memory
=> Reading event source file to memory
=> Uploading zip file to AWS Lambda eu-east-1 with parameters:
{ FunctionName: 'cloudwatch-to-slack-2',
  Code: { ZipFile: <Buffer 50 4b 03 04 14 00 08 00 08 00 a4 ab 39 4e 00 00 00 00 00 00 00 00 00 00 00 00 09 00 00 00 2e 44 53 5f 53 74 6f 72 65 ed 57 4d 6c dc 54 10 9e 6f b3 4d ... > },
  Handler: 'index.handler',
  Role: 'arn:aws:iam::xxxxxxxxxxx:role/cloudwatch-to-slack-role',
  Runtime: 'nodejs8.10',
  Description: 'Better Slack notifications for AWS CloudWatch',
  MemorySize: 128,
  Timeout: 60,
  Publish: false,
  VpcConfig: { SubnetIds: [], SecurityGroupIds: [] },
  Environment: { Variables: { UNENCRYPTED_HOOK_URL: 'https://hooks.slack.com/services/XXXXXXXXXXXXXXXXXXXX } },
  KMSKeyArn: '',
  DeadLetterConfig: { TargetArn: null },
  TracingConfig: { Mode: null } }
{ Error: connect ETIMEDOUT 92.242.140.21:443
    at Object._errnoException (util.js:1041:11)
    at _exceptionWithHostPort (util.js:1064:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1153:14)
  message: 'connect ETIMEDOUT 92.242.140.21:443',
  code: 'NetworkingError',
  errno: 'ETIMEDOUT',
  syscall: 'connect',
  address: '92.242.140.21',
  port: 443,
  region: 'eu-east-1',
  hostname: 'lambda.eu-east-1.amazonaws.com',
  retryable: true,
  time: 2019-01-25T21:31:56.154Z }
sallesma commented 5 years ago

I am facing the same issue. Does anyone have tips about it?

CodyReichert commented 5 years ago

Hmm..that's interesting. I haven't hit this, but for anyone seeing the same issue, you might try to play with the timeout setting. Since it's not hitting an error, just a timeout, it could just be that it needs a little longer.

You can't change this directly in the env, but this package uses node-lambda so I believe you can set the AWS_TIMEOUT variable (mentioned here):

$ AWS_TIMEOUT=120 npm run deploy

Alternatively, you could edit the last line in the scripts/deploy.sh file and add the --timeout 120 flag to the very last line (that flag is mentioned here).

I would try that out first. If anyone does it and it seems to work, we can figure out how to add an option to this package for it.

sallesma commented 5 years ago

I was eager to try your solution this morning, but the deploy worked directly with no timeout...

So problem fixed for me, but without knowing what would have been the fix

Thanks for helping anyways