Repository: amplify-education/serverless-domain-manager (ts)

Issue:
Failed to find hosted zone when there are more than 100 HZs
<!--- Please keep this note for the community --->

### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

<!--- Thank you for keeping this note for the community --->

## Bug Report

**Error Description**
When an AWS account has more than 100 hosted zones, the command, e.g. 
```shell
sls create_domain --stage prod --region eu-west-2
```
... fails with `Error: Could not find hosted zone "{ OUR.DOMAIN.NAME.HERE }"`

**Command Run**
e.g. `sls create_domain --stage prod --region eu-west-2`

**Console Output**
```sh
Error ---------------------------------------------------
 
  Error: Unable to create domain tabs.prod.eu-west-2.hungrycoder.net: Could not find hosted zone "{ OUR.DOMAIN.NAME.HERE }"
      at ServerlessCustomDomain.<anonymous> (/Users/Ben.Crowl/dev/tabs/node_modules/serverless-domain-manager/dist/src/index.js:190:23)
      at Generator.throw (<anonymous>)
      at rejected (/Users/Ben.Crowl/dev/tabs/node_modules/serverless-domain-manager/dist/src/index.js:6:65)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
```

**Domain Manager Configuration**
Replace this with your own `serverless.yml` file (anonymized, of course) to help us better resolve your issue.
```yaml
custom:
  customDomain: 
    domainName: OUR.DOMAIN.NAME.HERE
```

**Versions**
- Domain Manager version(s): v6.0.3
- Node/npm version: v14.18.1 / v8.11.0
- Serverless Version: v2.72.3
- Lambda Code: TypeScript

**Possible Solution**
The following lines need to get paged results (`node_modules/serverless-domain-manager/dist/src/aws/route53-wrapper.js`)
```
            try {
                const hostedZoneData = yield (0, utils_1.throttledCall)(this.route53, "listHostedZones", {});
                hostedZones = hostedZoneData.HostedZones;
            }
```


Pull request description:
AT-6961: Release 6.1.0
<!--- Information about referencing Github Issues: https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests --->
Fixes #510 

**Description of Issue Fixed**
Mutual TLS authentication with a couple of fixes and refactoring of the code

**Changes proposed in this pull request**:

* Mutual TLS authentication
* Dropped support of Node v12
* Fixed get paged result for listHostedZones
* Refactoring

<!--- Please remember to allow edits from maintainers: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork --->


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 02bc271..177667f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
 and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
 
+## [6.1.0] - 2022-08-10
+
+### Added
+- Add support for mutual TLS authentication for regional APIs. Thank you @cjuega ([505](https://github.com/amplify-education/serverless-domain-manager/pull/505))
+
+### Changed
+- Dropped Node v12 support
+- Fixed get paged result for listHostedZones
+- Refactoring
+
 ## [6.0.4] - 2022-08-04
 
 ### Fixed
diff --git a/README.md b/README.md
index 8fc9c42..dcd0ce0 100644
--- a/README.md
+++ b/README.md
@@ -212,6 +212,9 @@ And `ROUTE53_PROFILE` for creating route53 record in one AWS account and deploy
 ```
 export TEST_DOMAIN=example.com
 export ROUTE53_PROFILE=default
+export TLS_TRUSTSTORE_URI=s3://bucket-name/key-name
+export TLS_TRUSTSTORE_VERSION=default
+
 npm run build
 npm run integration-test
 ```
diff --git a/package-lock.json b/package-lock.json
index d2c5276..f6bafe0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "serverless-domain-manager",
-  "version": "6.0.3",
+  "version": "6.1.0",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -767,9 +767,9 @@
       "dev": true
     },
     "@types/node": {
-      "version": "18.6.3",
-      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.3.tgz",
-      "integrity": "sha512-6qKpDtoaYLM+5+AFChLhHermMQxc3TOEFIDzrZLPRGHPrLEwqFkkT5Kx3ju05g6X7uDPazz3jHbKPX0KzCjntg==",
+      "version": "18.6.5",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
+      "integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw==",
       "dev": true
     },
     "@types/responselike": {
@@ -1041,9 +1041,9 @@
       "dev": true
     },
     "aws-sdk": {
-      "version": "2.1186.0",
-      "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1186.0.tgz",
-      "integrity": "sha512-3yDWwNWgbSH9tRVyan0PlRU938Po9QH+06XHwRNwAa/6bixYl4L48c6YgpfxBpwl0IvcCCTivD7ZqshndwishQ==",
+      "version": "2.1191.0",
+      "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1191.0.tgz",
+      "integrity": "sha512-G8hWvuc+3rxTfHqsnUwGx/fy8zlnVPtlNesXMHlwU/l4oBx3+Weg0Nhng6HvLGzUJifzlnSKDXrOsWVkHtuZ1w==",
       "requires": {
         "buffer": "4.9.2",
         "events": "1.1.1",
@@ -1277,9 +1277,9 @@
       "dev": true
     },
     "caniuse-lite": {
-      "version": "1.0.30001311",
-      "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001311.tgz",
-      "integrity": "sha512-mleTFtFKfykEeW34EyfhGIFjGCqzhh38Y0LhdQ9aWF+HorZTtdgKV/1hEE0NlFkG2ubvisPV6l400tlbPys98A==",
+      "version": "1.0.30001375",
+      "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001375.tgz",
+      "integrity": "sha512-kWIMkNzLYxSvnjy0hL8w1NOaWNr2rn39RTAVyIwcw8juu60bZDWiF1/loOYANzjtJmy6qPgNmn38ro5Pygagdw==",
       "dev": true
     },
     "chai": {
@@ -4027,13 +4027,13 @@
       "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA=="
     },
     "object.assign": {
-      "version": "4.1.2",
-      "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz",
-      "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==",
+      "version": "4.1.3",
+      "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.3.tgz",
+      "integrity": "sha512-ZFJnX3zltyjcYJL0RoCJuzb+11zWGyaDbjgxZbdV7rFEcHQuYxrZqhow67aA7xpes6LhojyFDaBKAFfogQrikA==",
       "requires": {
-        "call-bind": "^1.0.0",
-        "define-properties": "^1.1.3",
-        "has-symbols": "^1.0.1",
+        "call-bind": "^1.0.2",
+        "define-properties": "^1.1.4",
+        "has-symbols": "^1.0.3",
         "object-keys": "^1.1.1"
       }
     },
diff --git a/package.json b/package.json
index 40d6714..c380158 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,8 @@
 {
   "name": "serverless-domain-manager",
-  "version": "6.0.4",
+  "version": "6.1.0",
   "engines": {
-    "node": ">=12"
+    "node": ">=14"
   },
   "description": "Serverless plugin for managing custom domains with API Gateways.",
   "author": "Amplify Education Inc",
@@ -48,7 +48,7 @@
   },
   "devDependencies": {
     "@types/mocha": "^9.1.1",
-    "@types/node": "^18.6.3",
+    "@types/node": "^18.6.5",
     "aws-sdk-mock": "^5.7.0",
     "chai": "^4.3.6",
     "chai-spies": "^1.0.0",
@@ -64,6 +64,6 @@
     "typescript": "^4.7.4"
   },
   "dependencies": {
-    "aws-sdk": "^2.1186.0"
+    "aws-sdk": "^2.1191.0"
   }
 }
diff --git a/src/aws/api-gateway-wrapper.ts b/src/aws/api-gateway-wrapper.ts
index 7766114..18f18e6 100644
--- a/src/aws/api-gateway-wrapper.ts
+++ b/src/aws/api-gateway-wrapper.ts
@@ -20,77 +20,100 @@ class APIGatewayWrapper {
      * Creates Custom Domain Name through API Gateway
      * @param domain: DomainConfig
      */
-    public async createCustomDomain(domain: DomainConfig): Promise<void> {
-        let createdDomain = {};
+    public async createCustomDomain(domain: DomainConfig): Promise<DomainInfo> {
+        const isEdgeType = domain.endpointType === Globals.endpointTypes.edge;
+        if (isEdgeType || domain.securityPolicy === Globals.tlsVersions.tls_1_0) {
+            // For EDGE domain name or TLS 1.0, create with APIGateway (v1)
+            return new DomainInfo(await this.createCustomDomainV1(domain));
+        } else {
+            // For Regional domain name create with ApiGatewayV2
+            return new DomainInfo(await this.createCustomDomainV2(domain));
+        }
+    }
+
+    /**
+     * Creates Custom Domain Name through API Gateway V1
+     * @param domain: DomainConfig
+     */
+    private async createCustomDomainV1(domain: DomainConfig): Promise<any> {
         const providerTags = {
             ...Globals.serverless.service.provider.stackTags,
             ...Globals.serverless.service.provider.tags
         };
 
-        // For EDGE domain name or TLS 1.0, create with APIGateway (v1)
+        const params: any = {
+            domainName: domain.givenDomainName,
+            endpointConfiguration: {
+                types: [domain.endpointType],
+            },
+            securityPolicy: domain.securityPolicy,
+            tags: providerTags,
+        };
+
         const isEdgeType = domain.endpointType === Globals.endpointTypes.edge;
-        const hasMutualTls = !!domain.tlsTruststoreUri;
-        if (isEdgeType || domain.securityPolicy === "TLS_1_0") {
-            // Set up parameters
-            const params = {
-                domainName: domain.givenDomainName,
-                endpointConfiguration: {
-                    types: [domain.endpointType],
-                },
-                securityPolicy: domain.securityPolicy,
-                [isEdgeType ? "certificateArn" : "regionalCertificateArn"]: domain.certificateArn,
-                tags: providerTags,
-            };
+        if (isEdgeType) {
+            params.certificateArn = domain.certificateArn;
+        } else {
+            params.regionalCertificateArn = domain.certificateArn;
 
-            if (!isEdgeType && hasMutualTls) {
+            if (domain.tlsTruststoreUri) {
                 params.mutualTlsAuthentication = {
                     truststoreUri: domain.tlsTruststoreUri
                 };
 
                 if (domain.tlsTruststoreVersion) {
-                    params.truststoreVersion = domain.tlsTruststoreVersion;
+                    params.mutualTlsAuthentication.truststoreVersion = domain.tlsTruststoreVersion;
                 }
             }
+        }
 
-            // Make API call to create domain
-            try {
-                // Creating EDGE domain so use APIGateway (v1) service
-                createdDomain = await throttledCall(this.apiGateway, "createDomainName", params);
-                domain.domainInfo = new DomainInfo(createdDomain);
-            } catch (err) {
-                throw new Error(`Failed to create custom domain '${domain.givenDomainName}':\n${err.message}`);
-            }
+        try {
+            return await throttledCall(this.apiGateway, "createDomainName", params);
+        } catch (err) {
+            throw new Error(
+                `API Gateway V1 failed to create custom domain '${domain.givenDomainName}':\n${err.message}`
+            );
+        }
+    }
 
-        } else { // For Regional domain name create with ApiGatewayV2
-            const params: any = {
-                DomainName: domain.givenDomainName,
-                DomainNameConfigurations: [{
-                    CertificateArn: domain.certificateArn,
-                    EndpointType: domain.endpointType,
-                    SecurityPolicy: domain.securityPolicy,
-                }],
-                Tags: providerTags
-            };
+    /**
+     * Creates Custom Domain Name through API Gateway V2
+     * @param domain: DomainConfig
+     */
+    private async createCustomDomainV2(domain: DomainConfig): Promise<any> {
+        const providerTags = {
+            ...Globals.serverless.service.provider.stackTags,
+            ...Globals.serverless.service.provider.tags
+        };
 
-            if (!isEdgeType && hasMutualTls) {
-                params.MutualTlsAuthentication = {
-                    TruststoreUri: domain.tlsTruststoreUri
-                };
+        const params: any = {
+            DomainName: domain.givenDomainName,
+            DomainNameConfigurations: [{
+                CertificateArn: domain.certificateArn,
+                EndpointType: domain.endpointType,
+                SecurityPolicy: domain.securityPolicy,
+            }],
+            Tags: providerTags
+        };
 
-                if (domain.tlsTruststoreVersion) {
-                    params.TruststoreVersion = domain.tlsTruststoreVersion;
-                }
-            }
+        const isEdgeType = domain.endpointType === Globals.endpointTypes.edge;
+        if (!isEdgeType && domain.tlsTruststoreUri) {
+            params.MutualTlsAuthentication = {
+                TruststoreUri: domain.tlsTruststoreUri
+            };
 
-            // Make API call to create domain
-            try {
-                // Creating Regional domain so use ApiGatewayV2
-                createdDomain = await throttledCall(this.apiGatewayV2, "createDomainName", params);
-                domain.domainInfo = new DomainInfo(createdDomain);
-            } catch (err) {
-                throw new Error(`Failed to create custom domain '${domain.givenDomainName}':\n${err.message}`);
+            if (domain.tlsTruststoreVersion) {
+                params.MutualTlsAuthentication.TruststoreVersion = domain.tlsTruststoreVersion;
             }
         }
+
+        try {
+            return await throttledCall(this.apiGatewayV2, "createDomainName", params);
+        } catch (err) {
+            throw new Error(
+                `API Gateway V2 failed to create custom domain '${domain.givenDomainName}':\n${err.message}`
+            );
+        }
     }
 
     /**
@@ -143,7 +166,8 @@ class APIGatewayWrapper {
                 Globals.logInfo(`Created API mapping '${domain.basePath}' for '${domain.givenDomainName}'`);
             } catch (err) {
                 throw new Error(
-                    `Unable to create base path mapping for '${domain.givenDomainName}':\n${err.message}`
+                    `Make sure the '${domain.givenDomainName}' exists.
+                     Unable to create base path mapping for '${domain.givenDomainName}':\n${err.message}`
                 );
             }
         } else { // Use ApiGatewayV2 for Regional domains
@@ -174,7 +198,9 @@ class APIGatewayWrapper {
                 {DomainName: domain.givenDomainName},
             );
         } catch (err) {
-            throw new Error(`Unable to get API Mappings for '${domain.givenDomainName}':\n${err.message}`);
+            throw new Error(
+                `Make sure the '${domain.givenDomainName}' exists. Unable to get API Mappings:\n${err.message}`
+            );
         }
     }
 
diff --git a/src/aws/route53-wrapper.ts b/src/aws/route53-wrapper.ts
index 74d523d..ff6c1d4 100644
--- a/src/aws/route53-wrapper.ts
+++ b/src/aws/route53-wrapper.ts
@@ -1,5 +1,5 @@
 import Globals from "../globals";
-import {throttledCall} from "../utils";
+import {getAWSPagedResults, throttledCall} from "../utils";
 import DomainConfig = require("../domain-config");
 import {Route53} from "aws-sdk";
 
@@ -106,8 +106,14 @@ class Route53Wrapper {
 
         let hostedZones = [];
         try {
-            const hostedZoneData = await throttledCall(this.route53, "listHostedZones", {});
-            hostedZones = hostedZoneData.HostedZones;
+            hostedZones = await getAWSPagedResults(
+                this.route53,
+                "listHostedZones",
+                "HostedZones",
+                "Marker",
+                "NextMarker",
+                {}
+            );
         } catch (err) {
             throw new Error(`Unable to list hosted zones in Route53.\n${err.message}`);
         }
diff --git a/src/domain-config.ts b/src/domain-config.ts
index e0c344b..ba24225 100644
--- a/src/domain-config.ts
+++ b/src/domain-config.ts
@@ -81,8 +81,7 @@ class DomainConfig {
         this.apiType = apiTypeToUse;
 
         const isEdgeType = this.endpointType === Globals.endpointTypes.edge;
-        const hasMutualTls = !!config.tlsTruststoreUri;
-        if (isEdgeType && hasMutualTls) {
+        if (isEdgeType && config.tlsTruststoreUri) {
             throw new Error(`${this.endpointType} APIs do not support mutual TLS, remove tlsTruststoreUri or change to a regional API.`);
         }
         if (config.tlsTruststoreUri) {
diff --git a/src/index.ts b/src/index.ts
index f1d1602..bc2479e 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -203,7 +203,7 @@ class ServerlessCustomDomain {
                     Globals.logInfo(`Searching for a certificate with the '${searchName}' domain`);
                     domain.certificateArn = await acm.getCertArn(domain);
                 }
-                await this.apiGatewayWrapper.createCustomDomain(domain);
+                domain.domainInfo = await this.apiGatewayWrapper.createCustomDomain(domain);
                 Globals.logInfo(`Custom domain '${domain.givenDomainName}' was created.
                  New domains may take up to 40 minutes to be initialized.`);
             } else {


Test patch:
diff --git a/test/integration-tests/basic.test.ts b/test/integration-tests/basic.test.ts
index 3fdbfb8..af50f2b 100644
--- a/test/integration-tests/basic.test.ts
+++ b/test/integration-tests/basic.test.ts
@@ -154,4 +154,15 @@ describe("Integration Tests", function () {
             await utilities.destroyResources(testName);
         }
     });
+
+    it("Mutual TLS", async () => {
+        const testName = "mutual-tls";
+        const configFolder = `${CONFIGS_FOLDER}/${testName}`;
+        try {
+            await utilities.createTempDir(TEMP_DIR, configFolder);
+            await utilities.slsDeploy(TEMP_DIR);
+        } finally {
+            await utilities.destroyResources(testName);
+        }
+    });
 });
diff --git a/test/integration-tests/basic/apigateway-with-export/handler.js b/test/integration-tests/basic/apigateway-with-export/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/basic/apigateway-with-export/handler.js
+++ b/test/integration-tests/basic/apigateway-with-export/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/basic/apigateway-with-export/serverless.yml b/test/integration-tests/basic/apigateway-with-export/serverless.yml
index eb498df..d310dcf 100644
--- a/test/integration-tests/basic/apigateway-with-export/serverless.yml
+++ b/test/integration-tests/basic/apigateway-with-export/serverless.yml
@@ -3,7 +3,7 @@ service: ${env:PLUGIN_IDENTIFIER}-apigateway-with-export-${env:RANDOM_STRING}
 
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   endpointType: REGIONAL
   stage: test
diff --git a/test/integration-tests/basic/apigateway-with-import/handler.js b/test/integration-tests/basic/apigateway-with-import/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/basic/apigateway-with-import/handler.js
+++ b/test/integration-tests/basic/apigateway-with-import/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/basic/apigateway-with-import/serverless.yml b/test/integration-tests/basic/apigateway-with-import/serverless.yml
index b0d270a..d75ae43 100644
--- a/test/integration-tests/basic/apigateway-with-import/serverless.yml
+++ b/test/integration-tests/basic/apigateway-with-import/serverless.yml
@@ -3,7 +3,7 @@ service: ${env:PLUGIN_IDENTIFIER}-apigateway-with-import-${env:RANDOM_STRING}
 
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
   apiGateway:
diff --git a/test/integration-tests/basic/basepath-mapping/handler.js b/test/integration-tests/basic/basepath-mapping/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/basic/basepath-mapping/handler.js
+++ b/test/integration-tests/basic/basepath-mapping/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/basic/basepath-mapping/serverless.yml b/test/integration-tests/basic/basepath-mapping/serverless.yml
index 5be4b25..f69c9db 100644
--- a/test/integration-tests/basic/basepath-mapping/serverless.yml
+++ b/test/integration-tests/basic/basepath-mapping/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-basepath-mapping-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
   stackTags:
diff --git a/test/integration-tests/basic/create-domain-idempotent/handler.js b/test/integration-tests/basic/create-domain-idempotent/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/basic/create-domain-idempotent/handler.js
+++ b/test/integration-tests/basic/create-domain-idempotent/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/basic/create-domain-idempotent/serverless.yml b/test/integration-tests/basic/create-domain-idempotent/serverless.yml
index bf95d48..8043493 100644
--- a/test/integration-tests/basic/create-domain-idempotent/serverless.yml
+++ b/test/integration-tests/basic/create-domain-idempotent/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-create-domain-idempotent-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
 functions:
diff --git a/test/integration-tests/basic/deploy-idempotent/handler.js b/test/integration-tests/basic/deploy-idempotent/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/basic/deploy-idempotent/handler.js
+++ b/test/integration-tests/basic/deploy-idempotent/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/basic/deploy-idempotent/serverless.yml b/test/integration-tests/basic/deploy-idempotent/serverless.yml
index e366ca4..8df761f 100644
--- a/test/integration-tests/basic/deploy-idempotent/serverless.yml
+++ b/test/integration-tests/basic/deploy-idempotent/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-deploy-idempotent-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
 functions:
diff --git a/test/integration-tests/basic/http-api-multiple/handler.js b/test/integration-tests/basic/http-api-multiple/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/basic/http-api-multiple/handler.js
+++ b/test/integration-tests/basic/http-api-multiple/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/basic/http-api-multiple/serverless.yml b/test/integration-tests/basic/http-api-multiple/serverless.yml
index 21d40ee..223b3a8 100644
--- a/test/integration-tests/basic/http-api-multiple/serverless.yml
+++ b/test/integration-tests/basic/http-api-multiple/serverless.yml
@@ -1,7 +1,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-http-api-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
   stackTags:
diff --git a/test/integration-tests/basic/mutual-tls/handler.js b/test/integration-tests/basic/mutual-tls/handler.js
new file mode 100644
index 0000000..1729e0e
--- /dev/null
+++ b/test/integration-tests/basic/mutual-tls/handler.js
@@ -0,0 +1,13 @@
+"use strict";
+
+module.exports.helloWorld = (event, _context, callback) => {
+  const response = {
+    statusCode: 200,
+    body: JSON.stringify({
+      message: "Go Serverless! Your function executed successfully!",
+      input: event,
+    }),
+  };
+
+  callback(null, response);
+};
diff --git a/test/integration-tests/basic/mutual-tls/serverless.yml b/test/integration-tests/basic/mutual-tls/serverless.yml
new file mode 100644
index 0000000..90bef32
--- /dev/null
+++ b/test/integration-tests/basic/mutual-tls/serverless.yml
@@ -0,0 +1,28 @@
+service: ${env:PLUGIN_IDENTIFIER}-mutual-tls-${env:RANDOM_STRING}
+provider:
+  name: aws
+  runtime: nodejs14.x
+  region: us-west-2
+  stage: test
+functions:
+  helloWorld:
+    handler: handler.helloWorld
+    events:
+      - http:
+          path: hello-world
+          method: get
+          cors: true
+plugins:
+  - serverless-domain-manager
+
+custom:
+  customDomain:
+    domainName: ${env:PLUGIN_IDENTIFIER}-mutual-tls-${env:RANDOM_STRING}.${env:TEST_DOMAIN}
+    autoDomain: true
+    endpointType: REGIONAL
+    tlsTruststoreUri: ${env:TLS_TRUSTSTORE_URI}
+    tlsTruststoreVersion: ${env:TLS_TRUSTSTORE_VERSION}
+
+package:
+  patterns:
+    - '!node_modules/**'
diff --git a/test/integration-tests/basic/null-basepath-mapping/handler.js b/test/integration-tests/basic/null-basepath-mapping/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/basic/null-basepath-mapping/handler.js
+++ b/test/integration-tests/basic/null-basepath-mapping/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/basic/null-basepath-mapping/serverless.yml b/test/integration-tests/basic/null-basepath-mapping/serverless.yml
index b285383..ca187ee 100644
--- a/test/integration-tests/basic/null-basepath-mapping/serverless.yml
+++ b/test/integration-tests/basic/null-basepath-mapping/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-null-basepath-mapping-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
   stackTags:
diff --git a/test/integration-tests/basic/route53-profile/handler.js b/test/integration-tests/basic/route53-profile/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/basic/route53-profile/handler.js
+++ b/test/integration-tests/basic/route53-profile/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/basic/route53-profile/serverless.yml b/test/integration-tests/basic/route53-profile/serverless.yml
index d1f877d..2f7a478 100644
--- a/test/integration-tests/basic/route53-profile/serverless.yml
+++ b/test/integration-tests/basic/route53-profile/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-route53-profile-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
 functions:
diff --git a/test/integration-tests/deploy/auto-domain/handler.js b/test/integration-tests/deploy/auto-domain/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/auto-domain/handler.js
+++ b/test/integration-tests/deploy/auto-domain/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/auto-domain/serverless.yml b/test/integration-tests/deploy/auto-domain/serverless.yml
index 3137572..459ef1d 100644
--- a/test/integration-tests/deploy/auto-domain/serverless.yml
+++ b/test/integration-tests/deploy/auto-domain/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-auto-domain-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
 functions:
diff --git a/test/integration-tests/deploy/basepath-nested-stack/handler.js b/test/integration-tests/deploy/basepath-nested-stack/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/basepath-nested-stack/handler.js
+++ b/test/integration-tests/deploy/basepath-nested-stack/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/basepath-nested-stack/serverless.yml b/test/integration-tests/deploy/basepath-nested-stack/serverless.yml
index 37aa375..095fcc4 100644
--- a/test/integration-tests/deploy/basepath-nested-stack/serverless.yml
+++ b/test/integration-tests/deploy/basepath-nested-stack/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-basepath-nested-stack-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
 functions:
diff --git a/test/integration-tests/deploy/basepath/handler.js b/test/integration-tests/deploy/basepath/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/basepath/handler.js
+++ b/test/integration-tests/deploy/basepath/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/basepath/serverless.yml b/test/integration-tests/deploy/basepath/serverless.yml
index f36743c..5674e5e 100644
--- a/test/integration-tests/deploy/basepath/serverless.yml
+++ b/test/integration-tests/deploy/basepath/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-basepath-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
 functions:
diff --git a/test/integration-tests/deploy/custom-apigateway/handler.js b/test/integration-tests/deploy/custom-apigateway/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/custom-apigateway/handler.js
+++ b/test/integration-tests/deploy/custom-apigateway/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/custom-apigateway/serverless.yml b/test/integration-tests/deploy/custom-apigateway/serverless.yml
index 4e33846..888e88a 100644
--- a/test/integration-tests/deploy/custom-apigateway/serverless.yml
+++ b/test/integration-tests/deploy/custom-apigateway/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-custom-apigateway-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
   apiGateway:
diff --git a/test/integration-tests/deploy/default/handler.js b/test/integration-tests/deploy/default/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/default/handler.js
+++ b/test/integration-tests/deploy/default/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/default/serverless.yml b/test/integration-tests/deploy/default/serverless.yml
index d6edba5..58e9614 100644
--- a/test/integration-tests/deploy/default/serverless.yml
+++ b/test/integration-tests/deploy/default/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-default-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
 functions:
diff --git a/test/integration-tests/deploy/http-api/handler.js b/test/integration-tests/deploy/http-api/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/http-api/handler.js
+++ b/test/integration-tests/deploy/http-api/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/http-api/serverless.yml b/test/integration-tests/deploy/http-api/serverless.yml
index da5b535..f05daa5 100644
--- a/test/integration-tests/deploy/http-api/serverless.yml
+++ b/test/integration-tests/deploy/http-api/serverless.yml
@@ -1,7 +1,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-http-api-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
 functions:
diff --git a/test/integration-tests/deploy/regional-basepath/handler.js b/test/integration-tests/deploy/regional-basepath/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/regional-basepath/handler.js
+++ b/test/integration-tests/deploy/regional-basepath/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/regional-basepath/serverless.yml b/test/integration-tests/deploy/regional-basepath/serverless.yml
index 2c02658..98791f6 100644
--- a/test/integration-tests/deploy/regional-basepath/serverless.yml
+++ b/test/integration-tests/deploy/regional-basepath/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-regional-basepath-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   endpointType: REGIONAL
   stage: test
diff --git a/test/integration-tests/deploy/regional-stage-basepath/handler.js b/test/integration-tests/deploy/regional-stage-basepath/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/regional-stage-basepath/handler.js
+++ b/test/integration-tests/deploy/regional-stage-basepath/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/regional-stage-basepath/serverless.yml b/test/integration-tests/deploy/regional-stage-basepath/serverless.yml
index cbb5826..1f1e45b 100644
--- a/test/integration-tests/deploy/regional-stage-basepath/serverless.yml
+++ b/test/integration-tests/deploy/regional-stage-basepath/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-regional-stage-basepath-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   endpointType: REGIONAL
   stage: test
diff --git a/test/integration-tests/deploy/regional-tls-1-0/handler.js b/test/integration-tests/deploy/regional-tls-1-0/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/regional-tls-1-0/handler.js
+++ b/test/integration-tests/deploy/regional-tls-1-0/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/regional-tls-1-0/serverless.yml b/test/integration-tests/deploy/regional-tls-1-0/serverless.yml
index bf396bd..8154ff7 100644
--- a/test/integration-tests/deploy/regional-tls-1-0/serverless.yml
+++ b/test/integration-tests/deploy/regional-tls-1-0/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-regional-tls-1-0-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
   endpointType: REGIONAL
diff --git a/test/integration-tests/deploy/route-53-latency-routing/handler.js b/test/integration-tests/deploy/route-53-latency-routing/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/route-53-latency-routing/handler.js
+++ b/test/integration-tests/deploy/route-53-latency-routing/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/route-53-latency-routing/serverless.yml b/test/integration-tests/deploy/route-53-latency-routing/serverless.yml
index 26d6374..13732bd 100644
--- a/test/integration-tests/deploy/route-53-latency-routing/serverless.yml
+++ b/test/integration-tests/deploy/route-53-latency-routing/serverless.yml
@@ -1,7 +1,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-route-53-latency-routing-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   endpointType: REGIONAL
   stage: test
diff --git a/test/integration-tests/deploy/route-53-weighted-routing/handler.js b/test/integration-tests/deploy/route-53-weighted-routing/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/route-53-weighted-routing/handler.js
+++ b/test/integration-tests/deploy/route-53-weighted-routing/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/route-53-weighted-routing/serverless.yml b/test/integration-tests/deploy/route-53-weighted-routing/serverless.yml
index a36f35b..05808cd 100644
--- a/test/integration-tests/deploy/route-53-weighted-routing/serverless.yml
+++ b/test/integration-tests/deploy/route-53-weighted-routing/serverless.yml
@@ -1,7 +1,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-route-53-weighted-routing-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   endpointType: REGIONAL
   stage: test
diff --git a/test/integration-tests/deploy/stage-basepath/handler.js b/test/integration-tests/deploy/stage-basepath/handler.js
index 8076060..1729e0e 100644
--- a/test/integration-tests/deploy/stage-basepath/handler.js
+++ b/test/integration-tests/deploy/stage-basepath/handler.js
@@ -1,11 +1,8 @@
 "use strict";
 
-module.exports.helloWorld = (event, context, callback) => {
+module.exports.helloWorld = (event, _context, callback) => {
   const response = {
     statusCode: 200,
-    headers: {
-      "Access-Control-Allow-Origin": "*", // Required for CORS support to work
-    },
     body: JSON.stringify({
       message: "Go Serverless! Your function executed successfully!",
       input: event,
diff --git a/test/integration-tests/deploy/stage-basepath/serverless.yml b/test/integration-tests/deploy/stage-basepath/serverless.yml
index 0012f6c..e484590 100644
--- a/test/integration-tests/deploy/stage-basepath/serverless.yml
+++ b/test/integration-tests/deploy/stage-basepath/serverless.yml
@@ -2,7 +2,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-stage-basepath-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
 functions:
diff --git a/test/integration-tests/deploy/web-socket/handler.js b/test/integration-tests/deploy/web-socket/handler.js
index 9d807dd..7964fe2 100644
--- a/test/integration-tests/deploy/web-socket/handler.js
+++ b/test/integration-tests/deploy/web-socket/handler.js
@@ -1,6 +1,6 @@
 "use strict";
 
-module.exports.connect = (event, context, callback) => {
+module.exports.connect = (_event, _context, callback) => {
   const response = {
     statusCode: 200,
   };
diff --git a/test/integration-tests/deploy/web-socket/serverless.yml b/test/integration-tests/deploy/web-socket/serverless.yml
index 523f55e..8e0eba3 100644
--- a/test/integration-tests/deploy/web-socket/serverless.yml
+++ b/test/integration-tests/deploy/web-socket/serverless.yml
@@ -1,7 +1,7 @@
 service: ${env:PLUGIN_IDENTIFIER}-web-socket-${env:RANDOM_STRING}
 provider:
   name: aws
-  runtime: nodejs12.x
+  runtime: nodejs14.x
   region: us-west-2
   stage: test
 functions:
diff --git a/test/unit-tests/index.test.ts b/test/unit-tests/index.test.ts
index 94f8f2f..c7848ad 100644
--- a/test/unit-tests/index.test.ts
+++ b/test/unit-tests/index.test.ts
@@ -756,10 +756,10 @@ describe("Custom Domain Plugin", () => {
 
             dc.certificateArn = "fake_cert";
 
-            await plugin.apiGatewayWrapper.createCustomDomain(dc);
+            const domainInfo = await plugin.apiGatewayWrapper.createCustomDomain(dc);
 
-            expect(dc.domainInfo.domainName).to.equal("foo");
-            expect(dc.domainInfo.securityPolicy).to.equal("TLS_1_2");
+            expect(domainInfo.domainName).to.equal("foo");
+            expect(domainInfo.securityPolicy).to.equal("TLS_1_2");
         });
 
         it("Create an HTTP domain name", async () => {
@@ -775,10 +775,10 @@ describe("Custom Domain Plugin", () => {
 
             dc.certificateArn = "fake_cert";
 
-            await plugin.apiGatewayWrapper.createCustomDomain(dc);
+            const domainInfo = await plugin.apiGatewayWrapper.createCustomDomain(dc);
 
-            expect(dc.domainInfo.domainName).to.equal("foo");
-            expect(dc.domainInfo.securityPolicy).to.equal("TLS_1_2");
+            expect(domainInfo.domainName).to.equal("foo");
+            expect(domainInfo.securityPolicy).to.equal("TLS_1_2");
         });
 
         it("Create a domain name with specific TLS version", async () => {
@@ -794,10 +794,10 @@ describe("Custom Domain Plugin", () => {
 
             dc.certificateArn = "fake_cert";
 
-            await plugin.apiGatewayWrapper.createCustomDomain(dc);
+            const domainInfo = await plugin.apiGatewayWrapper.createCustomDomain(dc);
 
-            expect(dc.domainInfo.domainName).to.equal("foo");
-            expect(dc.domainInfo.securityPolicy).to.equal("TLS_1_2");
+            expect(domainInfo.domainName).to.equal("foo");
+            expect(domainInfo.securityPolicy).to.equal("TLS_1_2");
         });
 
         it("Create a domain name with tags", async () => {