Thanos Thanos:
Any invader that set foot in Canada would have a nuclear bomb dropped on them by the US within an hour. Odds are the Americans would attack, including with nuclear weapons, and destroy the invasion fleet anyway if it ever crossed the North American territorial limit.
Unless of course it's the Americans themselves.
It may make me sound like a tinhatter, but I really think they are our only long term threat.
China, Russia and other would-be superpowers simply have too many threats/enemies on their borders to commit the resources to invade and capture a large nation like Canada on the other side of the world. That's the reason China and Russia have almost always had large armies and relatively small navies dedicated to protecting their coasts and maritime approaches - they are continental, not maritime powers.
However, in extreme circumstances, I could see the Americans deciding Canada looks better as part of the US than as an independent nation.
For me, the two largest threats are resource acquisition and climate change. Right now, we're more than willing to ship them whatever amounts they want of almost any resource we have (water is the one exception), but if a time comes in the future when we need oil, natural gas or whatever at home and can't afford to send it to them, then they could see that as a threat.
The other extreme is if temps go up too high and much of the US Southwest (and maybe even Southeast) becomes unlivable (extreme heat, flooding, drought, climate refugees from Central America, etc). At the same time, Canada's climate could become more temperate and encourage migrations north.
If Canada was unwilling to allow those migrations and/or bulk shipments of water to drought starved southern regions, the government of the day may decide on swallowing us to deal with those problems.
These of course are long term threats that I don't see emerging until sometime between 2050 - 2100. However, if the world gets its act together and we mitigate climate change, this may never come to pass. That would also reduce the likelihood of them invading us for resources (oil/NG most likely).