This is why nations tend to have things like large stores of long lasting foods, and do things like crop insurance, so that they actually have farmers after a bad year to feed their people.
It is a very risky profession and unless you want to depend on other nations for your continued survival is absolutely needed.
But how do they store and preserve that surplus for a longer time cheaply? Probably dehydration helps, but it adds some energy and storing costs.