node-premailer
node-premailer copied to clipboard
SyntaxError: Unexpected token I in JSON at position 0
I don't know what to do against this issue. It seems like I MOST OF THE TIMES get a broken JSON from node-premailer? I am always using the same parameters including URL, but most of the times I get the error message and 1 out of 5 times, the result variable contains the result. Does anybody else have this problem?
This is how I execute it:
premailer.prepare({ html: resBody }, function (err, result){
console.log(results) //undefined
})
And this is the error I get:
SyntaxError: Unexpected token I in JSON at position 0 at JSON.parse (
) at Request.handlePremailerResponse [as _callback] (/home/pi/newsfire/node_modules/premailer-api/premailer.js:103:23) at Request.self.callback (/home/pi/newsfire/node_modules/request/request.js:186:22) at emitTwo (events.js:106:13) at Request.emit (events.js:191:7) at Request. (/home/pi/newsfire/node_modules/request/request.js:1081:10) at emitOne (events.js:96:13) at Request.emit (events.js:188:7) at IncomingMessage. (/home/pi/newsfire/node_modules/request/request.js:1001:12) at Object.onceWrapper (events.js:290:19) at emitNone (events.js:91:20) at IncomingMessage.emit (events.js:185:7) at endReadableNT (_stream_readable.js:974:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) drin /home/pi/newsfire/lib/newsfire.js:114 html: result.html // html body ^ TypeError: Cannot read property 'html' of undefined at model.Query.PageLog.find.sort.limit.find (/home/pi/newsfire/lib/newsfire.js:114:29) at /home/pi/newsfire/node_modules/kareem/index.js:264:21 at /home/pi/newsfire/node_modules/kareem/index.js:127:16 at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)
Yup, same here:
err.stack
"SyntaxError: Unexpected token I in JSON at position 0
at Object.parse (native)
at Request.handlePremailerResponse [as _callback] (z:\xxxx\node_modules\premailer-api\premailer.js:103:23)
at Request.self.callback (z:\xxxx\node_modules\request\request.js:200:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.
For me this was a stylesheet include that couldn't be resolved. Once I had corrected that, it was fine.
Started getting this myself suddenly. No files have changed from working for months, has there been an NPM update that broke this?
Even the example-template in the repo returns this error!
Server is returning " Internal server error"