Raise an error if the api key isn't set or is nil.