Alexa getProductList unhandled rejection


#1

I’m trying to pull down all of my ISPs using getProductList however I’m getting the following

      unhandledRejection

  Error: Something went wrong
      at ClientRequest.https.get (C:\Users\Cameron\Documents\JovoTest\node_modules\jovo-platform-alexa\src\modules\InSkillPurchasePlugin.ts:189:35)
      at Object.onceWrapper (events.js:315:30)
      at emitOne (events.js:116:13)
      at ClientRequest.emit (events.js:211:7)
      at HTTPParser.parserOnIncomingClient (_http_client.js:551:21)
      at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
      at TLSSocket.socketOnData (_http_client.js:440:20)
      at emitOne (events.js:116:13)
      at TLSSocket.emit (events.js:211:7)
      at addChunk (_stream_readable.js:263:12)
      at readableAddChunk (_stream_readable.js:250:11)
      at TLSSocket.Readable.push (_stream_readable.js:208:10)
      at TLSWrap.onread (net.js:594:20)

My code is similar to what’s on the example page with the function swapped

this.$alexaSkill.$inSkillPurchase.getProductList((error, data) => {

Any ideas?


#2

Hey!

Looks like v1 code to me.

This should work:

try {
   let productList = await this.$alexaSkill.$inSkillPurchase.getProductList();
} catch (e) {
    console.log(e);
}

#3

Changed it to

let data = "";
		try{
            data = await this.$alexaSkill.$inSkillPurchase.getProductList();
            console.log("WE GOT THE DATA");
		}
		catch (e) {
			console.log(e);
        }

But it still throws the same error.

Error: Something went wrong
    at ClientRequest.https.get (C:\Users\Cameron\Documents\JovoTest\node_modules\jovo-platform-alexa\src\modules\InSkillPurchasePlugin.ts:189:35)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at HTTPParser.parserOnIncomingClient (_http_client.js:551:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
    at TLSSocket.socketOnData (_http_client.js:440:20)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at TLSSocket.Readable.push (_stream_readable.js:208:10)
    at TLSWrap.onread (net.js:594:20)

I’ve tried this both on the jovo debugger and a lambda but it gives the same error


#4

Such things unfortunately don’t work in the Jovo Debugger. The request to the ISP API needs the valid apiAccessToken which is in the Alexa request json.

Try it on a device or the Alexa Simulator.