Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

serverless-lambda-edge-pre-existing-cloudfront

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-lambda-edge-pre-existing-cloudfront - npm Package Compare versions

Comparing version 1.1.5 to 1.2.0

30

index.js

@@ -26,3 +26,2 @@ 'use strict'

)
for (let idx = 0; idx < events.length; idx += 1) {

@@ -35,5 +34,8 @@ const event = events[idx]

const functionArn = await this.getlatestVersionLambdaArn(functionObj.name)
const resolvedDistributionId = await (event.preExistingCloudFront.distributionId['Fn::ImportValue']
? this.resolveCfImportValue(this.provider, event.preExistingCloudFront.distributionId['Fn::ImportValue'])
: event.preExistingCloudFront.distributionId
)
this.serverless.cli.consoleLog(
`${functionArn} is associating to ${event.preExistingCloudFront.distributionId} CloudFront Distribution. waiting for deployed status.`
`${functionArn} (Event: ${event.preExistingCloudFront.eventType}, pathPattern: ${event.preExistingCloudFront.pathPattern}) is associating to ${resolvedDistributionId} CloudFront Distribution. waiting for deployed status.`
)

@@ -45,3 +47,3 @@

const config = await this.provider.request('CloudFront', 'getDistribution', {
Id: event.preExistingCloudFront.distributionId
Id: resolvedDistributionId
})

@@ -67,3 +69,3 @@

.request('CloudFront', 'updateDistribution', {
Id: event.preExistingCloudFront.distributionId,
Id: resolvedDistributionId,
IfMatch: config.ETag,

@@ -113,3 +115,5 @@ DistributionConfig: config.DistributionConfig

properties: {
distributionId: { type: 'string' },
distributionId: {
anyOf: [{ type: 'string' }, { type: 'object' }],
},
eventType: { type: 'string' },

@@ -191,3 +195,17 @@ pathPattern: { type: 'string' },

}
resolveCfImportValue(provider, name, sdkParams = {}) {
return provider.request('CloudFormation', 'listExports', sdkParams).then(result => {
const targetExportMeta = result.Exports.find(exportMeta => exportMeta.Name === name);
if (targetExportMeta) return targetExportMeta.Value;
if (result.NextToken) {
return this.resolveCfImportValue(provider, name, { NextToken: result.NextToken });
}
throw new Error(
`Could not resolve Fn::ImportValue with name ${name}. Are you sure this value is exported ?`
);
});
}
}
module.exports = ServerlessLambdaEdgePreExistingCloudFront

3

package.json
{
"name": "serverless-lambda-edge-pre-existing-cloudfront",
"version": "1.1.5",
"version": "1.2.0",
"description": "The Serverless Framework plugin which creates Lambda@Edge against pre-existing CloudFront.",
"main": "index.js",
"author": "serverless-operations",
"repository": "serverless-operations/serverless-lambda-edge-pre-existing-cloudfront",
"license": "MIT",

@@ -8,0 +9,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc