Issue with Custom Domain Setup in AWS Amplify (Next.js App Router + Route 53 + Kylos)

0

Hi everyone,

I'm using AWS Amplify for the first time to deploy a Next.js App Router application. Everything works fine on the default Amplify domain, but I've been facing issues when adding a custom domain from Kylos.pl.

After multiple attempts (around 20 times), I finally managed to get the domain status to "Available", but it still doesn’t seem to work properly.

Setup & Observations:

  1. I used the basic preset in Amplify (via Route 53) with redirection to the www subdomain.
  2. NS lookup & DNS checker confirm that the domain from Kylos correctly points to Route 53 through 4 NS records.
  3. The CNAME record for SSL verification, which was automatically created by Amplify, works fine.
  4. However, the main issue is that:
  • The root domain (pracownia-detal.pl) does not redirect via the A record to CloudFront.
  • The www subdomain does not redirect via the CNAME to CloudFront.
  • Amplify did not create its own CloudFront distribution for this setup.
  1. The DNS records in Route 53 were correctly added by Amplify.
  2. My Next.js app is already deployed and working on the Amplify default domain without any issues.
  3. The app uses AWS SES and Lambda functions for a form – could this affect custom domain setup?
  4. When visiting the root domain (pracownia-detal.pl) in a browser, the link automatically redirects to the www subdomain (www.pracownia-detal.pl). However, SSL does not seem to work, and the connection is marked as "not secure."

At this point, I'm not sure what’s preventing the custom domain from working correctly. Any help or insights would be greatly appreciated!

Thanks in advance!

1 Answer
0

The issues you're experiencing with your custom domain setup in AWS Amplify are not uncommon, and there are several potential causes and solutions to consider:

  1. DNS Propagation: DNS changes can take up to 48 hours to propagate globally. Ensure you've waited long enough for the changes to take effect. You can use online DNS lookup tools to check if the records are visible from different locations.

  2. SSL Certificate: Amplify uses AWS Certificate Manager (ACM) to provision SSL certificates for custom domains. Make sure the certificate for your domain has been successfully issued and validated by ACM. The "not secure" connection you're seeing suggests there might be an issue with the SSL configuration.

  3. CloudFront Distribution: It's unusual that Amplify didn't create its own CloudFront distribution for your setup. This could be the root cause of your issues. You may need to check if there are any existing CloudFront distributions associated with your app or domain.

  4. Redirection Configuration: The fact that the root domain is redirecting to the www subdomain suggests that some redirection is working, but it's not completing the process correctly. Double-check your redirection settings in Amplify and Route 53.

  5. CNAME and A Record Configuration: Verify that both the CNAME for the www subdomain and the A record for the root domain are correctly pointing to the appropriate CloudFront distribution.

  6. Amplify Console Settings: Review your domain settings in the Amplify Console to ensure everything is configured correctly.

  7. Cache Invalidation: If you've made changes to your app or domain settings, try invalidating the cache in the Amplify console.

To resolve these issues, you can try the following steps:

  1. Delete the custom domain from the Amplify console and start the process again, ensuring all DNS records are correctly set in Route 53.

  2. Use the AWS CLI or SDK to describe the ACM certificate and any associated CloudFront distributions to gather more detailed information about their current state.

  3. Check if there are any conflicting aliases or distributions using the AWS CLI command: aws cloudfront list-conflicting-aliases --alias your-domain.com

  4. Ensure that your AWS account has the necessary permissions to update CloudFront distributions and manage certificates in ACM.

  5. If the problem persists, you may need to contact AWS Support for more in-depth troubleshooting specific to your account and configuration.

Regarding your AWS SES and Lambda functions, these shouldn't directly affect the custom domain setup, but ensure that any environment variables or configurations referencing your domain are updated if necessary.

If none of these steps resolve the issue, engaging with AWS support might be your best option to get a more detailed analysis of your specific setup and resolve any underlying issues.
Sources
Amplify custom domain setup issue | AWS re:Post
Custom domain for Amplify not working | AWS re:Post
Can't Activate AWS Amplify Custom Domain | AWS re:Post

profile picture
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions