📚 Reference
📜 Chapter
Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (node:_tls_wrap:1532:34)
at TLSSocket.emit (node:events:527:28)
at TLSSocket._finishInit (node:_tls_wrap:946:8)
at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:727:12) {
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
import https from 'https';
export const validateSessionId = (sessionId: string) => {
const agent = new https.Agent({ rejectUnauthorized: false })
const host = process.env.NODE_ENV === 'production' ? '0.0.0.0' : '1.1.1.1';
const port = process.env.NODE_ENV === 'production' ? 8080 : 9999;
const options = {
host: host,
port: port,
path: '/validate',
method: 'GET',
agent: agent,
headers: {
Cookie: `sessionid=${sessionId}`,
}
}
const responseTest = https.request(options, (response) => {
console.log(response)
})
console.log('>>>> responseTest', responseTest)
}