The Alan Dean Foster TFA novelization addresses that: it was because toxin filtration wasn't standard in First Order suits, but needed special filters - and in this tactical situation, he didn't expect stormtroopers to consider using them by default, or even to check if they are needed.
Next to him, Rey was working hard to undo the results of her earlier repair. {{ to get the poison gases }} “This’ll work on stormtroopers?” she wondered as she manipulated the tools she had used earlier and left behind.
“Standard issue helmets are designed to filter out smoke, not toxins. To cope with the latter, a trooper needs to engage one of several special filters, depending on the specific contaminant. Identification is the province of one or two squad leaders. Having brought this ship on board theirs, I doubt anyone will think to check for airborne pollutants. It’s not like leading a ground assault, or forcing entry to an enemy warship. This is just an old freighter. Any kind of internal defense, much less something as nebulous as a gas counterattack, would be the last thing a squad sent to take its crew into custody would expect.”
To address the seeming contradiction, there are two possible answers:
Either the air filters mentioned in the answer's source were just as optional as First Order ones (the wording is brief enough to be unsure either way)
Or, the New Disney Canon simply disregarded the fact from EU/Legends, which the asnwer'sanswer's source (The New Essential Guide to Weapons and Technology) is part of.