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,475
  • 28
  • 40
  • 37
BastienSander
  • 1,605
  • 4
  • 22
  • 41

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
  • 11,303
  • 1
  • 19
  • 27