(CNN) โ€”ย A critical bloc of eight Senate Democratic centrists on Sunday helped advance a funding deal to reopen the government in exchange for a future vote on extendingย enhanced Affordable Care subsidies, putting Congress on a path to end theย longest shutdown in US historyย within days.

That deal would include a new stopgap measure to extend government funding until January and be tied to a larger package to fully fund several key agencies. It includes no guarantee from Republicans to extend the health care subsidies that have been at the heart of the funding fight.

What Democrats did secure is a future vote on the matter. Senate Majority Leader John Thune said on the chamber floor Sunday that he will hold a vote on a measure to extend the Affordable Care Act tax credits by the middle of next month. Democrats involved in the talks believe that will give enough time for House and Senate GOP leaders to negotiate a true compromise in the coming weeks, though it would be a major lift to get through a Republican-controlled Congress.

Despite the outrage from the rest of the Senate Democratic Caucus, GOP leaders are determined to move the funding measure quickly through Congress and to President Donald Trumpโ€™s desk in the coming days. Once Trump has signed it into law, itโ€™s still not clear how quickly agencies can restore services for the tens of millions of Americans facing shutdown pain, from the loss of federal food aid to child care closures to delayed paychecks. Senate GOP leaders have not yet scheduled a final passage vote.

โ€œI am optimistic that after almost six weeks of this shutdown, weโ€™ll finally be able to end it,โ€ Thune declared from the Senate floor on Day 40 of the funding lapse.

An exasperated Sen. John Hickenlooper of Colorado voted no on the deal but argued that his colleagues who supported it did not โ€œcaveโ€ and instead were doing โ€œwhat they feel is helping the most number of people.โ€

โ€œThereโ€™s no good solution,โ€ Hickenlooper said, adding that some of his colleagues believe Trump will โ€œstop at nothing to prevent that subsidy from being restored.โ€ He added: โ€œI voted no just because โ€ฆ piss off, Iโ€™m just frustrated. We tried it and now weโ€™re going to use every other tool. Weโ€™re not going to quit.โ€

Once the Senate has given final approval to the funding measure, it heads to the House, where Speaker Mike Johnson must muscle the deal through a fractious GOP conference โ€” likely with help from Trump himself. Itโ€™s not yet clear how many House Democrats will help Johnson with that job.

Behind the scenes, Senate Democrats who backed the deal to reopen the government say Trumpโ€™sย increasing oppositionย in recent days to extending the Obamacare subsidies forced them to change their position and accept a compromise to end an indefinite government shutdown, according to sources familiar with their thinking.

They believe that Democrats have an upper hand on the issue of health care and that a separate health care vote will spotlight the differences between the two parties, even though it has little chance of becoming law. And theyโ€™re not ruling out another shutdown showdown in January, when the next tranche of funding expires (though critical programs such as food aid and WIC will already be funded, to lessen the pain for millions of Americans).

Sen. Jeanne Shaheen, a retiring Democrat from New Hampshire, said Republicans made clear repeatedly over recent months that โ€œthis was the only deal on the table.โ€

โ€œNow I understand that not all of my Democratic colleagues are satisfied with this agreement, but waiting another week or another month wouldnโ€™t deliver a better outcome.โ€

Asked whether Democrats would willing to vote down the next funding measure on January 30 if Congress fails to deliver a health care fix by then, Shaheen said: โ€œThatโ€™s certainly an option that everybody will consider.โ€

The deal, which has been in the works for the last five weeks, came together between three former governors โ€” Shaheen of New Hampshire, Angus King of Maine and Maggie Hassan of New Hampshire โ€” along with Senate Majority Leader John Thune and the White House. Details of the deal were first reported by CNN.

One of those Democrats involved is Sen. Tim Kaine, who represents thousands of federal workers in Virginia and who said he supports the GOPโ€™s promise for a future vote on the subsidies.

โ€œLawmakers know their constituents expect them to vote for it, and if they donโ€™t, they could very well be replaced at the ballot box by someone who will,โ€ Kaine said of GOP senators who choose not to support extending the subsidies.

And importantly for Kaine, Democrats also secured an agreement from the White House to reverse its mass firings of federal workers during the shutdown, as well as protections against them happening the rest of this fiscal year. It also guarantees all federal workers will be paid for time during the shutdown.

But inside the Democratic Party, the funding deal has exposed a deep divide. Liberal senators were fuming at their colleagues for backing the deal, with House Democratic leaders vowing to โ€œfightโ€ the deal in the House.

Senate Democratic leadership was split on the vote, with Minority Leader Chuck Schumer opposing the deal while his No. 2, retiring Sen. Dick Durbin, supported it.

But some liberal senators have fiercely opposed the plan, including Sen. Richard Blumenthal of Connecticut.

โ€œFor me, itโ€™s no deal without health care,โ€ Blumenthal said, voicing a widespread sentiment in the Democratic caucus. โ€œSo far as Iโ€™m concerned, health care isnโ€™t included, and so Iโ€™ll be a no.โ€

Even some centrist-leaning Democrats, like Michigan Sen. Elissa Slotkin, voiced concerns with the idea on Sunday night.

โ€œI was involved for many weeks, and then over the last couple of weeks, it changed โ€” last week it changed,โ€ Slotkin said, noting that she was no longer involved in talks in recent days. โ€œBut I always said, like, itโ€™s got to do something concrete on health care, and itโ€™s hard to see how that happened.โ€

Across the Capitol, House Democratic leaders sharply condemned the deal. House Minority Leader Hakeem Jeffries said his caucus โ€œwill not support spending legislation advanced by Senate Republicans that fails to extend the Affordable Care Act tax credits,โ€ adding: โ€œWe will fight the GOP bill in the House of Representatives.โ€

One member, Rep. Ro Khanna of California,ย took to Xย on Sunday night calling for Schumer to be replaced. โ€œSenator Schumer is no longer effective and should be replaced. If you canโ€™t lead the fight to stop healthcare premiums from skyrocketing for Americans, what will you fight for?โ€ Khanna wrote.

House Democrats plan to have their own caucus huddle on Monday, according to a person familiar with the discussions.

The broader legislative package would include three full-year appropriations bills that deal with military construction and veterans affairs, the legislative branch and the Department of Agriculture. That includes $203.5 million in new funding to enhance security measures and protection for members of Congress in addition to $852 million for US Capitol Police, per a summary of the bill to fund the legislative branch provided by top Democratic appropriator Sen. Patty Murray.

The next step after Sunday nightโ€™s vote is a vote on the full measure, which includes the larger funding package negotiated between the two parties and a stopgap through January 30.

The Senate would first vote to take up the House-passed stopgap measure, which means eight Democrats would need to support it for it to advance. Then, the Senate would amend that bill with the larger funding package negotiated between the two parties.

Democratic Sen. John Fetterman, who has voted on the GOP funding plan throughout the shutdown and criticized his own partyโ€™s stance, said Sunday that it is time to โ€take the win.โ€

Vote yes, he said, โ€œand then we can find a way to lower our costs about health care.โ€

This story and headline have been updated with additional developments.