I am getting Access Denied and Incorrect Routing Issues in Deployment of Tailwind Next.js Starter Template on AWS.

0

Problem Statement:

The tailwind nextjs starter template is unable to be deployed properly on AWS using Github Actions. The deployment process involves pushing the export files to S3, and displaying them using S3 + Cloudfront + Route53.

One of my domains example: https://domainA.com works by just sharing this files to S3 without exporting them (Using github actions, I share this files to s3 and then connect it with cloudfront using Origin access identity. (It is working as expected)

but another one of my domains example: https://domainB.com doesn't work and gives access denied issue. (I checked bucket policy and it allows access to s3 bucket, bucket is publicly accessible)

I want to solve above error, please suggest options.

Now coming to another problem, As I have realized that the files in S3 should be output files and so I now export this files to s3 locations using github actions. The cloudfront is connected to s3 bucket using OAI or public origin access. Once everything is setup correctly, I am able to route to my domain but it is unable to work properly. I am assuming that the system is unable to locate additional files from S3 that it needs.

how can I also solve above error.

1 Answer
0

It is hard to say what the exact issue might be, but a few things to try.

  1. Can you access the content directly using the S3 URL?
  2. Can you access the content using the CloudFront domain name (e.g. abcd12345.cloudfront.net)?

Also, which error code is returned when you say access denied? 403? A 403 can happen when access to the specific object is restricted OR when the requested object does not exist. The default action for S3 is to return a 403 for missing objects, as opposed to 404, which is done as a security precaution.

profile pictureAWS
answered a year ago
  • Thank you for your response! I am unable to access the content through either the S3 URL or the CloudFront for https://domainB.com (PS - https://domainA.com is accessible only on Cloudfront and not on S3). I am receiving a 403 error, and I suspect it has something to do with a missing object.

    Considering this, I would appreciate any input or suggestions on how to proceed in resolving this problem.

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