Deployed hugo to AWS S3 hosted and returns "NoSuchKey" clicking on menu entry


I’m using Hugo 0.65.3 and the Hugo Book theme. My site is hosted on S3 with CloudFront and Lambda@Edge for authentication. Accessing the site works and css, as well as javascript files are loaded correctly, but when I try to navigate on the site with the menu on the left-hand side I get a “NoSuchKey” error from S3. In the browser inspector I can clearly see a 404 being returned.

I don’t understand why the S3 error message is returned, as I have configured the S3 bucket as a static website with ‘404.html’ as error page and ‘index.html’ as entry page. But the real pain for me is that the menu is not working.

Everything runs fine locally.

Anybody else trying to solve this problem, can find the solution here:

There are three solutions to fix this problem.

  1. Turn off CloudFront S3 Bucket Restriction under Origins.
  2. Enable Default Directory Indexing using Lambda@Edge - More info about this can be found Here
  3. Turn on uglyurl on Hugo.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.