While I don't normally agree with the knee-jerk moral outrage brigade in this particular instance I think they actually have a reasonable point.
This is a kids film and they are showing the use of someones allergy as a weapon against them. It's something that's very much within the realm of practicality for kids to do to each other at school for example.
The reaction portrayed in the film suggests that's it's an anaphylactic reaction (he uses an EPI-pen to treat the symptoms) which is as severe as it gets and could easily be fatal without rapid treatment.
Given that the overall rate of allergies in children has increased compared to when I was a kid portraying triggering someones allergy in what is presumably a comical way in a film aimed at relatively young children isn't really a good idea.