Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use connection reuse environment variable in Lambda #130

Merged
merged 3 commits into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eighty-monkeys-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'skuba': patch
---

template/lambda-sqs-worker: Use connection reuse environment variable
1 change: 1 addition & 0 deletions template/lambda-sqs-worker/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ functions:
reservedConcurrency: 20
timeout: 30
environment:
AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
Copy link

@tobyhei tobyhei Jul 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edit: nvm

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh awesome! It would be nice to include this and also have links to the relevant doco for both environment variables, as part of documenting more of the rationale behind these templates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobyhei any reasoning behind not adding that?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I was just going to suggest we add AWS_STS_REGIONAL_ENDPOINTS=regional but then thought it was scope creep for this PR so removed the comment

DESTINATION_SNS_TOPIC_ARN: !Ref DestinationTopic
ENVIRONMENT: ${env:ENVIRONMENT}
REGION: ${self:provider.region}
Expand Down
8 changes: 0 additions & 8 deletions template/lambda-sqs-worker/src/services/aws.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { Agent } from 'https';

import { SNS } from 'aws-sdk';

const agent = new Agent({
keepAlive: true,
rejectUnauthorized: true,
});

export const sns = new SNS({
apiVersion: '2010-03-31',
httpOptions: { agent },
});