To put it mildly, Silicon Valley has been on a good run. Badly bruised from the bursting of the dotcom bubble in 2000, it came back from it many times stronger, even if many of the names were new ones.

Even as Wall Street had its own near-death experience amid the collapse of Lehman, the technology giants on the other side of the US barely sneezed; indeed, many of the inventions and companies that have defined the new tech boom came to light during the financial crisis: the iPhone, Uber, Twitter.

Five of the world’s seven biggest listed companies are technology groups, not to mention some of the biggest and best IPO candidates such as Snapchat and Spotify.

Many governments have cosied up to internet companies, looking for a slice of their wealth and kudos. Look at it from the right angle, these companies look set to shape the future; we are living in the information age after all, and Google, Facebook and others are the gatekeepers. But in a few years, we may well look back on the present as a golden era for these titans: one in which they had free rein to patrol the internet, squeeze out any competitors and enjoy the fruits of benevolent governments, not to mention a sympathetic general public.

The web, computers and digital services have developed at a rapid pace: too rapidly, really, for anyone to take stock. Tax laws designed for an offline world have allowed Amazon to make much of its European sales out of Luxembourg, while Uber’s use of technology has allowed it to operate much like a taxi company while being subject to much looser regulations around private hire vehicles.

Telecoms services have been undercut by free chat apps run by Facebook and Apple that use the same infrastructure that those telecoms groups built. Consumers have cheered cheap books, rides and text messages, and politicians have praised innovation, while the grumbles of those negatively affected by them have often been dismissed as luddism.

But perhaps not for much longer. Cracks started to emerge in 2016. The European Union, which has long taken potshots at the Californian giants and the impact they have on home-grown companies, advanced into full-blown warfare against them.

Google was served with three charges of abusing monopoly power last year, each of which can ultimately result in a fine worth billions of dollars. Apple’s tax status in Ireland, which have seen it shelter huge sums there with the aim of eventually returning it to the US, was deemed illegal state aid. Facebook, which has typically evaded regulatory scrutiny up to this point, was also caught in Brussels’ glare when competition officials accused the company of misleading them over its purchase of WhatsApp in 2014.

The social network has also become a growing target for privacy campaigners uneasy about the wealth of data it has on its users, and has been accused of corroding democracy by allowing fake news to spread: politicians in some places are now talking about fining Facebook over it. 2017 is not likely to be easier.

While President Obama rubbed shoulders with tech bosses, his replacement called many of them out on the campaign trail. Donald Trump scorned Apple for making its gadgets in China instead of America, told Amazon it faces an antitrust investigation, and raised the idea of shutting down parts of the internet. Silicon Valley’s progressive streak sits uneasily with the conservative swell that voted Trump in. China, a market that tech companies have been denied access to or have had to compromise to survive in, is tightening its grip on the internet rather than loosening it: Apple was recently forced to remove the New York Times from its iPhone App Store under laws that ban apps “disrupting social order”.

Elsewhere, the “sharing economy”, the idea that consumers would rent out their homes or labour with apps like Airbnb and Uber skimming off the top, is facing a backlash. A tribunal in London ruled last year that Uber drivers should have basic employment rights; Airbnb is enforcing 90-day limits on rentals. The advertising industry is voicing a growing concern about the duopoly of Facebook and Google over digital revenues.

In Silicon Valley, the future is always bright; there is no shortage of opportunities waiting to be solved with technology. But the rest of the world is not necessarily on the same page.

Political commentators have not failed to notice how the liberal world order showed signs of fraying last year, and may face a full-blown crisis in this one. In parallel, the tech industry that thrived in that order may find itself in a similar bind in 2017. It is no coincidence that technology shares have underperformed the S&P 500 since the US election, with some of the biggest companies missing out on the Trump bump that has pushed US stock markets to record highs. Amid a dearth of big tech flotations, start-ups are now nervously eyeing Snapchat’s forthcoming IPO as a litmus test for 2017. The company’s value has been tentatively put at $25 billion, a sum that many see as overblown for an app with relatively miniscule revenues. Failing to live up to that billing could be a portentous moment for an industry that has not reckoned with the good times ending.

The Telegraph Group Limited, London 2017