Congress is set to pass a crucial spending bill that averts a government shutdown, but there's one potential obstacle: President Donald Trump.

Neither party wants the government to close ahead of the midterm elections that will determine control of Congress, but Trump has made clear his frustration at the lack of money for his long-promised wall along the U.S.-Mexico border. He says it is "ridiculous" the wall has yet to be fully funded.

With less than a week before a Sept. 30 deadline for a partial shutdown, Republican leaders hope they can get Trump to set aside his frustration about the wall and sign legislation that funds the military and a host of civilian agencies for the next year. The bill also would provide a short-term fix to keep the government running through Dec. 7.

Get Breaking News Delivered to Your Inbox

The Senate easily approved the measure last week, with only seven senators voting no.

The vote in the House is expected to be closer, with House conservatives voicing displeasure that money is included for Planned Parenthood but not the wall.

"You want to stanch a blue wave" of Democrats in the midterms? asked Rep. Andy Biggs, R-Ariz., a member of the conservative House Freedom Caucus. "Then keep your promises — and one of those promises is to build the wall."

Trump himself raised the possibility last week that he may not sign the measure unless wall funding is included.

"Where is the money for border security and the wall in this ridiculous spending bill?" Trump said Thursday on Twitter. Republicans "must finally get tough" against Democrats he said are obstructing law enforcement and border security, he added.

But it seems only Trump can stop the spending legislation from becoming law. Biggs and other conservatives admit they don't have the numbers to defeat the spending bill in the House, given that leaders from both parties support the legislation.

"I expect it to pass. The votes are going to be there," said Rep. Tom Cole, R-Okla., a senior member of the House Appropriations Committee who is among the best vote counters in the Capitol.

"There's substantial support" for the bill in both parties, Cole said. He emphasized that the measure increases defense spending — including the largest pay raise for the military in nearly a decade — and boosts funding for a range of domestic programs, including a 5 percent increase for the National Institute of Health, a priority of both parties.

"I think we're in pretty good shape," he said.

Still, many conservatives are unhappy.

"This bill funds things we said we wouldn't, like Planned Parenthood, but doesn't fund things we said we would, like the border security wall. That's unacceptable," said Rep. Jim Jordan, R-Ohio, a leader of the conservative wing of the GOP who has made himself a candidate to lead House Republicans after the midterm elections.

"Republicans need to actually do what we said," Jordan said.

House Speaker Paul Ryan, R-Wis., defended the bill, saying it fully funds the military while providing "historic" spending to fight the opioid epidemic, which takes the lives of more than 100 people in the U.S. every day.

"These are top priorities for the country, and we are ready to get this bill into law soon," Ryan said last week.

Ryan, Senate Majority Leader Mitch McConnell and other GOP lawmakers met with Trump earlier this month to plot strategy and urge the president not to force a shutdown.

Trump's stance has zigzagged. At times he has said he won't allow a shutdown before the midterm elections. At other times, he's mused that closing the government may be good for him politically.

"If it happens, it happens. If it's about border security, I'm willing to do anything," Trump said during a meeting with top Republican lawmakers this month.

McConnell insists there is "zero" chance of a shutdown and says a battle over the border wall should wait until after votes are cast in November.

Ryan, for his part, said GOP leaders "have a very good understanding with the president that we want to get our appropriations done. I'm confident our understanding will stick."