In the first visit to Agrabah, Sora must complete the Chasm of Challenges to proceed to the Treasure to obtain a treasure to barter for Jafar's lamp from the Peddler. As a reward for finishing the challenge, the door to the Treasure Room unlocks.
Redo the Cave of Wonders: Chasm of Challenges.
This article is too short to provide more than rudimentary information about the subject. You can help the Kingdom Hearts Wiki by expanding it.