WASHINGTON (Reuters) - The U.S. Congress on Thursday averted a government shutdown just one day before federal funding was due to expire, sending President Donald Trump a bill to provide just enough money to keep agencies operating through Jan. 19.

With lawmakers eager to begin a holiday recess until Jan. 3, the House of Representatives and Senate scurried to pass the hastily written bill by votes of 231-188 and 66-32, respectively.

When Congress returns, lawmakers will immediately have to get back to work on appropriating more money for a fiscal year that already will be three months old. They will try to pass an “omnibus” spending bill to fund the government from Jan. 19 through Sept. 30.

Negotiators have been struggling for months over thorny issues such as the amount of defense-spending increases versus increases for other domestic programs, including medical research, opioid treatment and “anti-terrorism” activities.

Fiscal hawks, meanwhile, are angry that Congress is again moving to bust through spending caps that had been designed to tamp down mounting federal debt.

But some of those same lawmakers in the Republican-controlled Congress earlier in the week voted for a sweeping tax bill that will add $1.5 trillion over the next 10 years to a national debt that already stands at $20 trillion.

With the clock ticking toward a deadline of midnight on Friday when government funding would run out, Democrats in the House and Senate made a strong pitch for including protections for young immigrants who entered the country illegally as children, popularly known as “Dreamers.”

In the end, the Congressional Hispanic Caucus and immigration advocacy groups failed. But nearly all of the House’s 193 Democrats and 29 of the Senate’s 46 Democrats voted no, in part to protest the lack of action on the immigration measure.

Shortly before the House and Senate votes, Democratic Representative Luis Gutierrez told reporters, “We’re really tired of tomorrow,” referring to years of failed attempts in Congress to protect Dreamers from deportation, allow them to legally work in the United States and get on a path to citizenship.

Slideshow ( 4 images )

They will resume their fight in January, aiming to win on the next spending bill or a separate measure.

Trump has eliminated Obama-era temporary protections for Dreamers, but has asked Congress to come up with a permanent solution by March. In the meantime, about 122 Dreamers a day are becoming vulnerable to deportation while Congress bickers.

Slideshow ( 4 images )

Also on Thursday, the Senate put the brakes on another bill that passed the House, which would provide $81 billion in new disaster aid to help Puerto Rico, the U.S. Virgin Islands and several states hit by this year’s hurricanes or wildfires.

The temporary spending bill did, however, give Trump a modest increase of $4.7 billion for the Department of Defense to be used for missile defense and ship repair.

The bill includes $2.85 billion to fund the Children’s Health Insurance Program through March and funding for community health centers and the Indian Health Service.

The plan also would extend the National Security Agency’s expiring internet surveillance program, known as Section 702 of the Foreign Intelligence Surveillance Act, through Jan. 19.

Other provisions address funding for veterans, the Coast Guard and flood insurance.

Most government programs would be temporarily extended until Jan. 19 at fiscal 2017 levels.