1

I am using Jimp (https://github.com/oliver-moran/jimp)

Jimp.read(originalUrl)

It works like a charm in most case.

If i use it for example with this url => Jimp.read('https://404store.com/2017/12/08/Random-random-30798866-500-325.jpg')

I get the following error:

Error
unable to verify the first certificate _tls_wrap.js in TLSSocket. at line 1105:38
events.js in emitNone at line 106:13
events.js in TLSSocket.emit at line 208:7
_tls_wrap.js in TLSSocket._finishInit at line 639:8
_tls_wrap.js in TLSWrap.ssl.onhandshakedone at line 469:38


I want to read the image even if there is a problem with the certificate. I don't want to configure the behaviour globally to the server.


Here is the server configuration :

  • Jimp Version: 0.4.0
  • Operating System: Ubuntu Server 16.04
  • Node version: v8.11.1

I already read this but didn't find the answer I'd like => Error: unable to verify the first certificate in nodejs

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
BastienSander
  • 1,718
  • 4
  • 24
  • 50

1 Answers1

2

Pass rejectUnauthorized: false in headers.

https://github.com/oliver-moran/jimp/tree/master/packages/jimp

Also, you can pass rejectUnauthorized: false if you don't require an SSL certificate to be valid (it helps to prevent unable to verify the first certificate error).

Do like this:

  url: originalUrl, // Required!
  headers: {rejectUnauthorized:false},
  ...
})
harrrrrrry
  • 13,643
  • 2
  • 23
  • 28