I am trying to connect to the AVS API with Node.js as the client, but I keep getting a strange error while trying to read from amazon's response:
Error:
{ Error: Parse Error
at TLSSocket.socketOnData (_http_client.js:411:20)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:191:7)
at readableAddChunk (_stream_readable.js:178:18)
at TLSSocket.Readable.push (_stream_readable.js:136:10)
at TLSWrap.onread (net.js:559:20) bytesParsed: 0, code: 'HPE_INVALID_CONSTANT' }
and here is my code:
var options = {
url: 'https://avs-alexa-na.amazon.com/v20160207/directives',
headers: {
'Authorization': 'Bearer ' + JSON.parse(localStorage.getItem('CREDS')).access_token
}
};
request.get(options).then((result) => {
console.log(result)
// localStorage.setItem('CREDS', result);
res.send("Authenticated")
})
I did some research and it said this would be an issue on Amazon's side, any workaround or fixes in the near future?
via Vikaton
No comments:
Post a Comment