(CNN) Early Friday morning, the Senate passed a $1.3 trillion spending package that will increase funding for the military and domestic spending and will keep the government funded through the end of September, sending the legislation to the President for his signature house ahead of a midnight deadline.

The Senate passed the bill after a whirlwind day where at least two Republican senators held up the legislative process and made it appear unclear whether the bill could pass ahead of the deadline. The bill passed 65-32, averting a potential government shutdown and funding the government through September 30.

The House passed the legislation earlier Thursday, voting 256-167 with Democrats and Republicans coming together to pass it less than 24 hours after the 2,300-page bill was made public.

President Donald Trump signed the bill later Friday after he threatened to veto it earlier over a lack of an immigration solution, though members of his administration have said as recently as Thursday that the President will sign the measure. The President criticized the bill and warned Congress "I will never sign another bill like this again."

The Senate needed unanimous consent -- meaning all members have to agree -- to bring the bill up for a timely vote. If one member objected, it could have forced the government into a brief shutdown, which is why many congressional observers were watching Kentucky Republican Sen. Rand Paul, who forced a brief shutdown last month using a similar procedural maneuver.

On Thursday, Paul spent hours criticizing the bill and the process by which the legislation is made public and passed, and appeared to live-tweeting as he scanned the measure.

"Page 430 of 'crumni-bus: Good news. The government is going to "earn" $350 million by selling oil from Strategic Petroleum Reserve," he tweeted . "Bad news is the $ won't go to reduce the $21 trillion debt. The $ will be instead be spent elsewhere by the Federal government."

Earlier Thursday, Vermont Sen. Patrick Leahy asked Senate Majority Leader Mitch McConnell when the Senate would vote -- he smiled and said in front of reporters, "whenever Sen. Paul decides we can."

But Paul said Thursday night that Senate leadership should reach out to him if they want to speed the process along.

"It's just the way the rules are," he told CNN's Phil Mattingly. "I mean, they will eventually beat me. Time will run out and they will eventually win but if they'd like to do it in a more expeditious fashion, all they've got to do it call me."

Paul said he was open to "compromise" but did specify what that would entail, but shortly after he spoke with CNN, Paul and McConnell spoke, a Paul spokesman said.

Paul not the only issue

While senators waited to see if there would be a vote Thursday night, several Republicans -- including Ted Cruz of Texas and Joni Ernst of Iowa -- came out against the bill, though there's no indication that any of those senators would delay the timing on the vote.

Another notable holdout Thursday night was Idaho Republican Sen. Jim Risch. While Paul's tirade against leadership was more public, behind the scenes aides were scrambling to satisfy Risch, who was holding up the spending bill because a provision renamed the White Clouds Wilderness preserve in Idaho to the "Cecil D. Andrus-White Clouds Wilderness" preserve, after the former Democratic Idaho governor.

First approached by what one source described as an "angry" Risch Thursday morning, Senate staff spent an entire day trying to figure out not just how to satisfy Risch's concerns -- which were made clear to be serious from an early stage -- but also exactly why they existed. Aides soon realized stemmed back to a home-state political rivalry with Andrus, the sources said.

There were meetings with staff and the senator in the cloakroom, just off the Senate floor. That led to a meeting in Minority Leader Chuck Schumer's office, and finally, a phone call to House Speaker Paul Ryan to lay out exactly how to get the name changed or removed. The potential solution, which was quietly and quickly approved on the Senate floor by unanimous consent, was in the form of an enrollment correction to the omnibus, which would have stripped the new name of the reserve from the bill.

At one point, Risch appeared on the floor with McConnell and Risch was clearly agitated. From the gallery, he could be overheard telling McConnell, "I'm not going to consent to do anything."

But in the end, after a full day of work that included not just Senate and House staff, but also White House involvement, Risch agreed to allow the vote to move forward. As to the name of the preserve? That will stay. House leaders declined to give Risch a commitment that they will take up the corrections measure to strip the language, and aides say they will not.

Risch declined to comment when asked about the situation by reporters. He voted against the final bill.

What's in the plan and who supports it

The massive spending package marks the end of a months-long funding stalemate in which lawmakers were forced to pass one short-term spending bill after another to stave off a shutdown. The package includes more than just money to fight the opioid epidemic, pay the military and fund more than $21 billion in infrastructure projects. It also includes policy changes like one that would incentivize states to enter more records into the country's gun background check system and another that would cut off aide to the Palestinian Authority until Palestinians cease making payments to the families of terrorists.

Trump will sign the omnibus bill if it reaches his desk, Mick Mulvaney, the director of the Office of Management and Budget, told reporters on Thursday.

Mulvaney admitted that the bill wasn't perfect and wasn't exactly what the White House wanted, but that -- on the whole -- the bill "funds (Trump's) priorities."

While the bill attracted broad bipartisan support in the House, it didn't win over everyone. On the right, lawmakers blasted the bill as a prime example of Washington's bloated spending.

"If the bill passed the way it is, I would -- I hope the White House does -- does veto it. I don't know if they will. It's been a long process so they may not, but I think it's not good for the American taxpayer, and it's not consistent with -- in any way close to consistent with what we said we would do when they elected us in 2016," said Jim Jordan, a member of the House Freedom Caucus.

On the left, some Democrats rejected the proposal because it didn't include permanent protectees under for recipients of the Deferred Action for Childhood Arrivals program.

"Anyone who votes for the omnibus is voting for the deportation of Dreamers and other immigrants. You will be voting to take money from law-abiding taxpayers -- some of whom are immigrants -- and give that money to privately-run prisons that will make a profit off of each and every human being our government hands over to them for detention and then deportation," Luis Gutierrez, a Democrat from Illinois, said in a statement.

The internal GOP backlash to the amount of spending and the process of rushing the measure through just 16 hours after it was released was on full display on the House floor on Thursday. Twenty-five House Republicans broke with their leadership and opposed the usually party line procedural vote bringing up the legislation. But the measure narrowly passed 211-207.