Closed ANF-Studios closed 3 months ago
Update. This error keeps popping up,
FetchError: invalid json response body at https://alexa-bot-api-web-server.vercel.app/api/alexa?stimulus=what?lang=undefined reason: Unexpected token I in JSON at position 0
at /home/pi/Desktop/lmfao/node_modules/node-fetch/lib/index.js:272:32
at processTicksAndRejections (node:internal/process/task_queues:93:5)
at async Alexa.getReply (/home/pi/Desktop/lmfao/node_modules/alexa-bot-api/src/alexa.js:19:12)
at async Client.<anonymous> (/home/pi/Desktop/lmfao/main.js:124:13) {
type: 'invalid-json'
Why does this happen?
Because a) Sometimes while json-ifying it this is what response you get
There is no fix for this unless @Major-Thrust fixes it himself.
res.name
will always return undefined as that is not a json property.
That's because the property is reply
. That's what this pr changes.
Update. This error keeps popping up,
FetchError: invalid json response body at https://alexa-bot-api-web-server.vercel.app/api/alexa?stimulus=what?lang=undefined reason: Unexpected token I in JSON at position 0 at /home/pi/Desktop/lmfao/node_modules/node-fetch/lib/index.js:272:32 at processTicksAndRejections (node:internal/process/task_queues:93:5) at async Alexa.getReply (/home/pi/Desktop/lmfao/node_modules/alexa-bot-api/src/alexa.js:19:12) at async Client.<anonymous> (/home/pi/Desktop/lmfao/main.js:124:13) { type: 'invalid-json'
There is no fix for this unless Major-Thrust fixes it himself.
But we can handle it. I'll add a catch block.
Also some rather useless changes but what are you getting by returning e? You need language too buddy.
@insomnia-creator, why though? It never returned that, what? Secondly, don't you think that's rather... pointless? Because, the client is providing the language, not the API or us.
This pull request addresses a fix for issue #5.