Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Two hours before a midnight deadline, Congress has narrowly averted a shutdown of the Department of Homeland Security for one week, setting up another funding showdown for next Friday.

Hours before a midnight deadline, the House easily approved a one-week extension of the funding. The vote was 357-60. It required two-thirds of members’ support to pass.

President Barack Obama later signed the bill.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

The move means that DHS will not experience a shutdown at midnight, but it also fails to resolve the impasse created when the House initially lashed together the agency’s budget and so-called “riders” that would gut the president’s immigration proposals. Some House conservatives said that Obama’s actions are unconstitutional and must be stopped – even at the cost of a DHS funding lapse.

The one-week funding vote came after an embarrassing defeat for House Speaker John Boehner earlier Friday. The House failed to pass a three-week extension of the funding as fifty-two Republicans and almost all Democrats voted against the measure. Conservatives called the stopgap bill a cave to the White House because it did not address immigration; Democrats derided it as a temporary solution and vowed not to “bail out” Boehner by giving him enough support to get the bill over the finish line.

But Minority Leader Nancy Pelosi reversed course later Friday night, instructing House Democrats to back the one-week measure. She said that they would have the opportunity to support a one-year “clean” funding bill next week.

An aide to Boehner dismissed the notion that the Speaker and Pelosi cut any kind of deal to bring up the clean bill next week, saying "there was no such promise made."

Before the final vote, Obama convened a meeting with key staff, including DHS head Jeh Johnson, late Friday to discuss the impending deadline, White House spokesman Josh Earnest said.

As lawmakers furiously negotiated behind closed doors, the Department of Homeland Security issued a 46-page document outlining procedures for a possible funding lapse, including an outline of which employees would be exempt from the shutdown.

In the event of a shutdown, Department of Homeland Security Secretary Jeh Johnson has said that about 80 percent of DHS employees would still be required to come to work but would not be paid until Congress acts.