We study a scenario in which a firm designs the compensation contract for a salesperson who exerts unobservable effort to increase the level of uncertain demand and, jointly, the firm also decides the inventory level to be stocked. We use a newsvendor-type model in which actual sales depend on the realized demand but are limited by the inventory available, and unfulfilled demand cannot be observed. In this setup, under the optimal contract, the agent is paid a bonus for meeting a sales quota. Our key result is that it may be optimal for the firm to stock more than the first-best inventory level, because this enables the firm to obtain a more precise indicator of the salesperson's effort. The possibility of stockouts due to limited inventory also leads to several counterintuitive results, including the following: (i) relative to when stockouts are not considered, it may be optimal for the firm to pay a higher bonus even though limited inventory constrains sales; (ii) as inventory becomes more expensive, thereby forcing the firm to lower its inventory, the firm may nevertheless pay the agent a higher bonus; and (iii) if there is a lower probability that the agent's effort exertion leads to high demand, rather than lowering inventory due to the lower sales potential, the firm may increase inventory.