Pages custom domain - That domain is already associated with an existing project

For Workes & Pages, what is the name of the domain?

NA

What is the error number?

What is the error message?

That domain is already associated with an existing project

What is the issue or error you’re encountering

Can’t add a custom domain to cloudflare pages

What steps have you taken to resolve the issue?

Already resolved this issue but this is clearly a bug on Cloudflare pages platform.

I created a new Cloudflare Pages instance and tried to connect custom domain to it but I got an error “That domain is already associated with an existing project”. I then checked if any other projects were using the domain but they were not (both through Dashboard and API). I tried to remove other projects to be sure (I had the domain connected to them in the past), but the delete requests failed on the Cloudflare Dashboard.

Through Cloudflare API / cURL I was able to remove the old project. The request took a long time so I suspect the requests on dashboard might just have been timed out? After this I were able to add the domain to the new pages project.

On summary there seems to be multiple issues with Pages and custom domains

  1. Pages did not list inactive connected domain in Dashboard / API. Presumably the custom domain had been previously removed from DNS but not from Pages which left the custom domain in invisible and inactive state. I suggest that also inactive domains should be visible in Pages Custom domain listing. And/or DNS entries for connecting custom domain to pages should be editable only from Pages setting
    1.1. The error message should describe which project the domain is connected to
  2. Delete project with this kind of invisible & inactive domain fails in Cloudflare dashboard with generic error, perhaps due to timeout. Project could be successfully removed only through Cloudflare API.

Best regards,
Max

Similar issues: