No one said "fire arms are not effective against bears" - just that only works when you have a fire arm, and are aware of the nearby bear. Else its becomes a different story ...
Be sure you have a large enough caliber ...
https://gunwatch.blogspot.com/2019/03/pistols-or-handguns-95-effective-when.html
Yes I am sure I have large enough calibers.