I used the AWS CDK to deploy the aws-amplify and everything seems to be deployed correctly. Once it got deployed, I triggered the build in the AWS amplify via console. It got built with the branch I configured and deployed and gave me a public URL to access the site. I was able to access my site with that URL without any problem.
However, I decided to add a custom domain for my aws amplify app . (I already have the hosted zone created in route 53.) Now I added the cdk code for adding domain to my app. It got deployed via cdk deploy without any error, but here comes the problem. I tried using the custom domain to view my app. It throws me access denied error, however I can access the app with the url given by aws amplify https://{branchname}.amplify.com. But not with the custom domain which I configured.
So I went to the manage subdomain page via aws console , did not update anything there, just clicked the update button. Surprisingly my custom domain started working.
I have faced this problem more than 3 times after every new deployment and every time I use to fix the access denied error, by simply updating the manage domain page(just click update button) via aws console.
Can anyone help me in understanding why this is not working in cdk, but working through aws management console update. Thanks in advance.
Not sure what am I missing in the cdk.
Note: I'm trying to deploy next js ssr app.