How 11 Lost Lines of Code Almost Broke the Internet

istock
istock / istock

It turns out that deleting a little bit of code can have some pretty big repercussions. Last week, an angry programmer removed an 11-line package of Javascript code from the open source platform NPM as part of an argument with the messaging company Kik. What he, and the rest of the Internet, didn’t realize was that his code was integral to a vast range of websites, including Netflix and Facebook.

Though the 11 lines of code were only offline for around 10 minutes, Science Alert explains, programmer Azer Koçulu came pretty close to inadvertently breaking the Internet.

It all started when representatives from Kik asked Koçulu to change the name of a program he was working on, also called Kik. When Koçulu refused, Kik turned to NPM as a sort of moderator, asking the popular open source platform to weigh in on the argument. NPM ultimately sided with the messaging company, and a frustrated Koçulu decided to delete his account with NPM, as well as all the 273 modules he’d uploaded.

One of those modules, explains Business Insider, was “npm left-pad,” an extremely basic, but also extremely popular, module used by independent coders and giant software companies alike.

“Sometimes, software ends up relying on what's essentially a house of cards: One Node.js module calls on another, calls on another, calls on another," Business Insider explains. "Again, usually it works fine—right up until 'npm left-pad' is taken offline.”

Programmers instantly noticed something was wrong (The Register reports over a thousand software projects were affected) and NPM took swift action, re-publishing "left-pad," despite Koçulu’s decision to delete it. Though Koçulu is still frustrated with NPM, he claims he never intended to bring down the Internet.

"Feeling very sorry for interrupting people's work," he said in an email to Ars Technica. "I did it for the benefit of the community in long term. NPM's monopoly won't be dictated to the free software community anymore."

[h/t Science Alert]