timlrx/tailwind-nextjs-starter-blog

Tags page unauthorized on AWS - Fixed

Opened this issue · 1 comments

Fixed Issue - see comments


I'm in the process of transferring my blog over to this template (thanks for this) from Jekyll..

I have set it up to deploy to AWS using sst.

The blogs pages and the tag homepage works, but clicking on individual tags gives an error:

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>REQUEST_ID</RequestId>
<HostId>HOST_ID</HostId>
</Error>

example here: https://unegma.blog/tags (then click a tag)

This seems like the kind of error which I'd usually get when trying to access a file in a private aws bucket, and I'm wondering if it has anything to do with the system trying to fetch the xml files from the public/tags/tag/tag.xml

Any thoughts or ideas? Really not sure how to debug this, but I've done a 'bind' between the application and the bucket in my sst config, so I'm not sure why that would be an issue. Happy to post sst config if useful.


Update:

On further research:

https://unegma.blog/tags/tech?_rsc=1yyo8

These requests are all blocked as well (403), seems to be related to React Server Components?


Update:

Visiting:
https://unegma.blog/tags
Works

Visiting:
https://unegma.blog/tags/
Throws the same unauthorised error as visiting a tag page (e.g. unegma.blog/tags/tag)

Visiting:
https://unegma.blog/posts
Works

Visiting:
https://unegma.blog/posts/
Redirects to the blog page without the trailing /

I'm trying to work out what is happening differently within the application that causes the tag pages to be handled differently, so any feedback on that would be helpful and welcome. Thanks.

That was a killer to debug but got there in the end (chatgpt was not really all that helpful either).

so apparently, because the feed.xml files were being put into public/tags/mytag/feed.xml, it was interfering with the nextjs routes (I didn't realise that these routes take precedence over the nextjs router). I solved the issue by putting the rss feed into public/tag/mytag/feed.xml (needed to update the rss generation script and the metadata connecting the blog with the rss feed).