WASHINGTON (Reuters) - The U.S. House of Representatives approved a stopgap government funding bill on Thursday that would avoid a government shutdown by maintaining current spending levels through Nov. 21.

FILE PHOTO - The dome of the U.S. Capitol Building is seen as the sun sets on Capitol Hill in Washington, U.S., July 26, 2019. REUTERS/Erin Scott

By a 301-123 vote, lawmakers sent the measure, known as a continuing resolution, on to the Senate. To take effect, it must be approved by both chambers of Congress and signed into law by President Donald Trump.

Opposing the measure were 119 Republicans, or about 60 percent of the party’s House caucus, plus three Democrats and one independent.

“No amendments allowed and members were given less than 24 hours to read the bill before voting on it. I voted no,” Republican Representative Thomas Massie said on Twitter.

The measure is intended to give lawmakers time to agree on more comprehensive funding legislation. They must first overcome differences on funding priorities, from healthcare to defense and immigration, including Trump’s demand for money for a wall on the U.S.-Mexico border that Democrats oppose.

“We’ve proven that we can do it,” House Republican leader Kevin McCarthy said of the looming budget challenge. “I think we can get this done.”

The continuing resolution was hammered out during negotiations involving members of both parties and both chambers.

Lawmakers adopted a two-year budget and debt deal in July that authorized discretionary defense and non-defense programs. But Congress still needs to pass annual legislation to fund agencies. Without approval of the new measure, funding would expire after midnight on Sept. 30, when the current federal fiscal year ends.

The government shut down for more than a month in December and January, after Trump initially refused to sign a spending bill without funding for the border wall.

The new funding measure requires the Department of Agriculture to report to Congress by the end of October on payments made to U.S. farmers under the Trump administration’s trade war mitigation program, according to an aide who said payments to foreign-owned companies would have to be listed.

In composing the measure, lawmakers avoided border policy proposals from liberal Democrats to better ensure passage by both the Democratic-controlled House and Republican-led Senate.

The measure does include funding that Democrats sought for public-health centers and for the Medicaid healthcare program in the U.S. territory of Puerto Rico.