From 3bf44449f68d3851d94cd84367b3e04876cafaf0 Mon Sep 17 00:00:00 2001 From: Patryk Milewski Date: Tue, 30 Mar 2021 22:20:41 +0200 Subject: [PATCH 1/3] fix: now it lists all of the certificates in the aws account --- index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 28f91c9..ecdc73d 100644 --- a/index.js +++ b/index.js @@ -130,8 +130,15 @@ class CreateCertificatePlugin { .then(() => this.serverless.cli.log('serverless-certificate-creator: disabled.')); } - listCertificates() { - return this.acm.listCertificates({}).promise(); + listCertificates(NextToken) { + return this.acm.listCertificates({ NextToken }).promise() + .then(data => { + if (data.NextToken) { + return this.listCertificates(data.NextToken) + .then(moreData => [...moreData, ...data.CertificateSummaryList]); + } + return Promise.resolve(data.CertificateSummaryList) + }) } /** @@ -194,7 +201,7 @@ class CreateCertificatePlugin { getExistingCertificate() { return this.listCertificates().then(data => { - let existingCerts = data.CertificateSummaryList.filter(cert => cert.DomainName === this.domain); + let existingCerts = data.filter(cert => cert.DomainName === this.domain); if (existingCerts.length > 0) { return existingCerts[0]; } @@ -523,8 +530,8 @@ class CreateCertificatePlugin { } return this.listCertificates() - .then(({ CertificateSummaryList }) => { - let cert = CertificateSummaryList.filter(({ DomainName }) => DomainName == domainName)[0]; + .then((certificates) => { + let cert = certificates.filter(({ DomainName }) => DomainName == domainName)[0]; if (cert && cert[property]) { return cert[property]; } else { From 2be761efbded321f4e7c5e97a54155c61cca1861 Mon Sep 17 00:00:00 2001 From: Patryk Milewski Date: Wed, 31 Mar 2021 22:05:18 +0200 Subject: [PATCH 2/3] fix: styling fixes --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ecdc73d..8707473 100644 --- a/index.js +++ b/index.js @@ -530,7 +530,7 @@ class CreateCertificatePlugin { } return this.listCertificates() - .then((certificates) => { + .then(certificates => { let cert = certificates.filter(({ DomainName }) => DomainName == domainName)[0]; if (cert && cert[property]) { return cert[property]; From 91b26a51e279088df98dbfa946891fd37e895403 Mon Sep 17 00:00:00 2001 From: schwamster Date: Sat, 10 Apr 2021 00:19:15 +0200 Subject: [PATCH 3/3] fixes #40 100+ certs --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index faba1cf..0f12725 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "serverless-certificate-creator", - "version": "1.5.2", + "version": "1.5.3", "description": "creates a certificate that can be used for custom domains for your api gateway", "main": "index.js", "scripts": {