#Remix link doesn't work with AWS CloudFront

1 messages · Page 1 of 1 (latest)

misty quest
#

Hi,
I build a marketing site with Remix and deployed to Fly. Everything works fine. I then put AWS CloudFront in front of Fly and the page still works fine.

However, when I navigate to an internal page by clicking on a Remix Link component, the page crashes.

TypeError: Cannot destructure property 'data' of 'r' as it is undefined.

Basically, the loader returns nothing

const data = useLoaderData<LoaderData>();
// data is undefined 

If I refresh the page, it works again.

I wonder why Remix Link is broken when I add CloudFront. How could it be possible and how to fix it?

Update: I start to think loader doesn't work when navigate with Remix Link (with CloudFront)

marble crater
#

I haven't tried deploying to cloudfront yet, but I plan to. There are a couple example repositories I have been browsing the code:

one uses the AWS CDK: https://github.com/m14t/starter-aws-cdk

the other use the architecture framework on AWS: @remix-run/architect