question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: CloudFront input failed validation. Could not find next.js pages for "viewerCertificate"

See original GitHub issue

When attempting to add an ACM certificate to the CloudFront distribution, getting the error after deploying:

Error: CloudFront input failed validation. Could not find next.js pages for “viewerCertificate”

Here is the serverless.yaml:

myNextJSApp:
  component: "serverless-next.js@1.14.0"
  inputs:
    cloudfront:
      viewerCertificate: 
        - acmCertificateArn: "arn:aws:acm:us-east-1:xxxxxxxxxxxxx:certificate/xxxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxxxxxxx"

I do see the cloudfront distribution updating in the console, but that cert does not get added in fails with the above message.

The reason I am going down this route of trying to add the ACM cert (and CNAME), is because I want to point my A record from another AWS account to this distribution.

When I try to use go the input domain route, I get the message _Error: Domain was not found in your AWS account. Please purchase it from Route53 first then try again, since the domain is in a different AWS account. It seems like this wont work with a multi account organization for dev and prod, since it appears as the domain has to be in the same account as Cloudfront distribution.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lone-cloudcommented, Jul 7, 2020

Actually it wouldn’t yet work on version 14 that you’re using. Try with this component “@sls-next/serverless-component@1.15.0-alpha.5”. The domain should be in the same aws org account afaik.

1reaction
lone-cloudcommented, Jul 7, 2020

aws-cloudfront was already pulled into this project. We can make any changes to it in here. Also that lib is not being used to set the viewerCertificate as you would think.

@promediacorp you inputs are not correct. It’s not obvious in this case, but try:

  component: "serverless-next.js@1.14.0"
  inputs:
    cloudfront:
      defaults:
         viewerCertificate: 
           - AcmCertificateArn: "arn:aws:acm:us-east-1:xxxxxxxxxxxxx:certificate/xxxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxxxxxxx"```
Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve the "InvalidViewerCertificate" error exception when ...
While trying to create or update an Amazon CloudFront distribution, I receive an "InvalidViewerCertificate" error exception. How can I ...
Read more >
next/image went missing when deployed to AWS (Next.js)
I eventually found out that it was a configuration issue with Nginx. As Nextjs Image component will send the image source path with...
Read more >
serverless-nextjs-custom-plugin - npm
Start using serverless-nextjs-custom-plugin in your project by ... The new version has feature parity with nextjs 9.0 and does not use ...
Read more >
CloudFront Gives 502 Error Only for Home Page of Next.js App
When I try to access the homepage of my next.js Lambda app, CloudFront gives the following error: 502 ERROR The request could not...
Read more >
Amazon CloudFront - Developer Guide - cloudfront.net
Amazon's trademarks and trade dress may not be used in connection with any product or service ... Found 1 error while validating the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found