# Custom Domain set up for Next.js App Confusion. Invalid Viewer Certificate Error

**URL:** <https://forum.serverless.com/t/custom-domain-set-up-for-next-js-app-confusion-invalid-viewer-certificate-error/12824>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [October 11, 2020, 9:20pm UTC](https://forum.serverless.com/t/custom-domain-set-up-for-next-js-app-confusion-invalid-viewer-certificate-error/12824 "2020-10-11T21:20:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grantmontgomery](https://avatars.discourse-cdn.com/v4/letter/g/22d042/32.png) [@grantmontgomery](https://forum.serverless.com/u/grantmontgomery)\
**Post date:** [October 11, 2020, 9:20pm UTC](https://forum.serverless.com/t/custom-domain-set-up-for-next-js-app-confusion-invalid-viewer-certificate-error/12824/1 "2020-10-11T21:20:46Z")

</div>

Hey everyone I’m trying to set up t\* he serverless.yml file to host custom domains. Right now my domain is hosted on Route 53 and I also have a certificate and a hosted zone in US-East 1 generated for it in AWS. My domain is [sekndapp.com](http://sekndapp.com) and the domain and certificate are for that domain. I can’t find much help in configuring the .yml file and right now it looks like this.

- 

```
myNextApplication:

```

- 

```
  component: "@sls-next/serverless-component@1.17.0"

```

- 

```
  inputs:

```

- 

```
    domain: ["", "sekndapp.com"]

```

The error that was coming up said this.

> InvalidViewerCertificate: The certificate that is attached to your distribution doesn’t cover the alternate domain name (CNAME) that you’re trying to add. For more details, see: [Using custom URLs by adding alternate domain names (CNAMEs) - Amazon CloudFront](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-requirements).

I’m confused on how to configure this and to get it to work. Where could I add the CNAME record and is there anything else I need to add to configure the .yml file?
