My client's site 301 redirects example.com
to www.example.com
However, Google Search Console is saying that example.com is the canonical version of the homepage.
The homepage is performing terribly (if you search for the site, it shows the terms and conditions as the main page!), and whilst I had assumed the site must have a penalty for historical dodgy back-links, I'm now thinking it is actually an issue with what Google are choosing as canonical.
If you search for text taken from the homepage, the non-www version is indexed for it, even though that page does not actually exist. Click the link and you are redirected, as expected.
I've not had to do any SEO for a while, and I see that preferred domain setting is no longer a thing in the console, as I had initially assumed that the client had just set up the wrong domain there.
There was a broken link to an old sitemap in the console, which I have deleted in the off-chance Google was using a cached version of that which included non-www links. I have only just done this, so I don't know if that will fix the issue.
Is there anywhere else where Google may be being told to make the non-www version canonical?
The only other fix I can think of is to set the homepage to have a canonical meta tag, but it makes no sense to me that Google would not be doing this by default when only one page exists. Also, the non-www doesn't have the same content (it has no content), so it isn't a duplicate content issue where a canonical tag may make sense.
As I say, the site has had some dodgy link building in the past, so if anyone has had similar side effects from a penalty, please do say, as I haven't entirely ruled that out for bad performance (despite a lot of disavowal work). The console lists no penalties.
Update: I just looked at Bing and Duck Duck Go, and they are both indexing the correct version. It is just a Google issue.