Skip to content

Commit

Permalink
Merge pull request #315 from cbm-gplassard/master
Browse files Browse the repository at this point in the history
Use pagination when there are too many certificates fixes #314
  • Loading branch information
jconstance-amplify committed Apr 21, 2020
2 parents 91c9a4f + 8475ff2 commit 4268e1e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions index.ts
Expand Up @@ -260,13 +260,18 @@ class ServerlessCustomDomain {

let certificateArn; // The arn of the choosen certificate
let certificateName = this.serverless.service.custom.customDomain.certificateName; // The certificate name
let certData;
try {
certData = await this.acm.listCertificates(
{ CertificateStatuses: certStatuses }).promise();
let certificates = [];
let nextToken;
do {
const certData = await this.acm.listCertificates(
{ CertificateStatuses: certStatuses, NextToken: nextToken }).promise();
certificates = certificates.concat(certData.CertificateSummaryList);
nextToken = certData.NextToken;
} while (nextToken);

// The more specific name will be the longest
let nameLength = 0;
const certificates = certData.CertificateSummaryList;

// Checks if a certificate name is given
if (certificateName != null) {
Expand Down

0 comments on commit 4268e1e

Please sign in to comment.