sdk-node
sdk-node copied to clipboard
Uncaught SyntaxError
Had a server crash with the trace: SyntaxError: Unexpected token H in JSON at position 0
https://github.com/AuthorizeNet/sdk-node/blob/aab2dac8bb057e5f245a8a52dea017f71e1a36e2/lib/apicontrollersbase.js#L102
Looks like the server was returning
HTML><HEAD>
Hi,
Can you please provide information about the request you are sending and the full response you get from the servers?
the same issue
2019-11-15T16:25:01.121Z error: uncaughtException: Unexpected token H in JSON at position 0
SyntaxError: Unexpected token H in JSON at position 0
at JSON.parse (<anonymous>)
at Request._callback (/app/node_modules/authorizenet/lib/apicontrollersbase.js:102:29)
at Request.self.callback (/app/node_modules/request/request.js:185:22)
at Request.emit (events.js:210:5)
at Request.EventEmitter.emit (domain.js:476:20)
at Request.<anonymous> (/app/node_modules/request/request.js:1161:10)
at Request.emit (events.js:210:5)
at Request.EventEmitter.emit (domain.js:476:20)
at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:299:28)
at IncomingMessage.emit (events.js:215:7)
at IncomingMessage.EventEmitter.emit (domain.js:476:20)
at endReadableNT (_stream_readable.js:1183:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21) SyntaxError: Unexpected token H in JSON at position 0
at JSON.parse (<anonymous>)
at Request._callback (/app/node_modules/authorizenet/lib/apicontrollersbase.js:102:29)
at Request.self.callback (/app/node_modules/request/request.js:185:22)
at Request.emit (events.js:210:5)
at Request.EventEmitter.emit (domain.js:476:20)
at Request.<anonymous> (/app/node_modules/request/request.js:1161:10)
at Request.emit (events.js:210:5)
at Request.EventEmitter.emit (domain.js:476:20)
at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:299:28)
at IncomingMessage.emit (events.js:215:7)
at IncomingMessage.EventEmitter.emit (domain.js:476:20)
at endReadableNT (_stream_readable.js:1183:12)
This happens when your server gives a 500 error. By the way, today your system has been buggy for about 15 minutes, while nothing is said about this in your monitoring system!
https://status.authorize.net/
I can confirm this issue again.
The block is not in try catch and causes a server crash. Happening a lot of times now and sometimes the payment also goes through but it returns the above response which is very strange.
Is there anyone looking into it? I can submit a pull request to at least add better error handling to avoid crashes.
Is this issue being looked at? I have just gotten the same issue and it seems to be still existing in latest version of the SDK.
TCS-Dev saikumarkale- issue is fixed in the latest patch, September 2024 Release - v1.0.9