Add a custom domain to a branch doesn't work

I have two branches on my GitHub repo: main and staging.

I followed this guide to set up the custom domain staging.mydomain.com to deploy the changes made to the staging branch.

I also modified the DNS to have the CNAME record staging points to staging.mydomain.pages.dev.

However, when I navigate to staging.mydomain.com, I got this:

This page isn’t working

staging.mydomain.com is currently unable to handle this request.

HTTP ERROR 500

What did I miss?

The guide I followed was this one: https://developers.cloudflare.com/pages/how-to/custom-branch-aliases/

What’s the domain and pages.dev?

it’s complish.ai and complish.pages.dev

The error is coming from the Function. It’s doing a env.ASSETS.fetch which returns a 404 and then the Function is returning 500

You will need to debug the Function to see why that is happening and fix it.

2 Likes

Thank you. It turns out the env vars didn’t get copied over to the preview branch.

1 Like

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