{"id":18046,"library":"node-red-contrib-https","title":"Node-RED HTTPS Request with Peer Certificate Output","description":"This Node-RED contribution provides an enhanced HTTP Request node specifically designed for making HTTPS requests. It extends the core Node-RED HTTP Request node by adding the `msg.peerCertificate` property to the output message, allowing flow developers to inspect the server's TLS/SSL certificate after a successful connection. This is crucial for applications requiring advanced certificate validation or logging. The package is currently at version 2.0.0, indicating a stable release with potential breaking changes from previous major versions. Node-RED contrib packages typically follow an as-needed release cadence, driven by user feedback and Node-RED core updates. Its key differentiator is the direct exposure of the `peerCertificate` object, which is not available in the standard Node-RED HTTP Request node, making it indispensable for secure or compliance-driven integrations.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","https","node-red","certificates","peerCertificates"],"install":[{"cmd":"npm install node-red-contrib-https","lang":"bash","label":"npm"},{"cmd":"yarn add node-red-contrib-https","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-red-contrib-https","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This is a Node-RED contribution package and requires a Node-RED instance to function.","package":"node-red","optional":false}],"imports":[{"note":"Node-RED nodes are installed via npm into the Node-RED environment, not imported into user JavaScript code. The node then appears in the Node-RED editor palette.","wrong":"import { httpsRequest } from 'node-red-contrib-https'","symbol":"node-red-contrib-https","correct":"npm install node-red-contrib-https"},{"note":"After installation, the node becomes available in the Node-RED editor's sidebar palette. Its visual representation is typically similar to the standard HTTP Request node.","symbol":"HTTPS Request Node (from palette)","correct":"Drag 'HTTPS Request' from the Network section of the Node-RED palette into your flow."},{"note":"The `peerCertificate` object is directly added to the root of the `msg` object by this node, not nested within `msg.payload`.","wrong":"msg.payload.peerCertificate","symbol":"msg.peerCertificate","correct":"msg.peerCertificate"}],"quickstart":{"code":"[{\"id\":\"b9e4a3c1.9c6f98\",\"type\":\"tab\",\"label\":\"HTTPS Request with Peer Certificate\",\"disabled\":false,\"info\":\"\"},{\"id\":\"e3f0d2b7.4a1e5c\",\"type\":\"https request\",\"z\":\"b9e4a3c1.9c6f98\",\"name\":\"Fetch example.com cert\",\"method\":\"GET\",\"ret\":\"obj\",\"paytoqs\":\"qs\",\"url\":\"https://example.com/\",\"tls\":\"\",\"persist\":false,\"proxy\":\"\",\"authType\":\"\",\"senderr\":false,\"x\":390,\"y\":100,\"wires\":[[\"c1d0a2f5.e3b4d6\"]]},{\"id\":\"c1d0a2f5.e3b4d6\",\"type\":\"debug\",\"z\":\"b9e4a3c1.9c6f98\",\"name\":\"Show Peer Certificate\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"peerCertificate\",\"targetType\":\"msg\",\"statusVal\":\"\",\"statusType\":\"auto\",\"x\":620,\"y\":100,\"wires\":[]},{\"id\":\"a7b8c9d0.e1f2a3\",\"type\":\"inject\",\"z\":\"b9e4a3c1.9c6f98\",\"name\":\"Trigger Request\",\"props\":[{\"p\":\"payload\"},{\"p\":\"topic\",\"vt\":\"str\"}],\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"x\":170,\"y\":100,\"wires\":[[\"e3f0d2b7.4a1e5c\"]]} ]","lang":"json","description":"This Node-RED flow demonstrates how to use the 'HTTPS Request' node to fetch data from `example.com` and then display the `peerCertificate` object in the debug sidebar."},"warnings":[{"fix":"Review the node's configuration options and ensure backward compatibility for `msg.peerCertificate` structure, especially if parsing specific certificate fields.","message":"Upgrading to version 2.0.0 might introduce configuration changes or subtle behavior differences compared to 1.x versions. Always test flows in a non-production environment after upgrading.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure that your Node.js environment trusts the certificate authority for the target server. For self-signed certificates in development, consider setting `rejectUnauthorized` to `false` (with caution) or providing a custom CA certificate.","message":"Incorrectly configured TLS options (e.g., self-signed certificates, invalid CAs, or `rejectUnauthorized` set to `true` without proper CA trust) will lead to connection errors, preventing any `peerCertificate` output.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always check for the existence of `msg.peerCertificate` before attempting to access its properties (e.g., `if (msg.peerCertificate) { ... }`) and handle error paths in your flow.","message":"The `peerCertificate` property is only present on the `msg` object if the HTTPS connection is successfully established. If the connection fails due to network issues, certificate validation, or other errors, `msg.peerCertificate` will be undefined.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2.0.0':77 'ad':38 'advanc':66 'allow':46 'applic':64 'as-need':98 'avail':127 'break':84 'cadenc':102 'certif':8,55,67,152 'chang':85 'complianc':144 'compliance-driven':143 'connect':59 'contrib':93 'contribut':14 'core':30,111 'crucial':62 'current':74 'design':22 'develop':48 'differenti':115 'direct':118 'driven':103,145 'enhanc':17 'exposur':119 'extend':28 'feedback':106 'flow':47 'follow':96 'http':18,34,134 'https':4,25,148 'indic':78 'indispens':139 'inspect':50 'integr':146 'javascript':147 'key':114 'log':70 'major':88 'make':24,137 'messag':45 'msg.peercertificate':40 'need':100 'node':2,12,20,32,36,91,109,132,136,150 'node-r':1,11,31,90,108,131,149 'object':123 'output':9,44 'packag':72,94 'peer':7 'peercertif':122,153 'potenti':83 'previous':87 'properti':41 'provid':15 'red':3,13,33,92,110,133,151 'releas':81,101 'request':5,19,26,35,135 'requir':65 'secur':141 'server':52 'specif':21 'stabl':80 'standard':130 'success':58 'tls/ssl':54 'typic':95 'updat':112 'user':105 'valid':68 'version':76,89","created_at":"2026-04-25T04:59:27.362635+00:00","updated_at":"2026-04-25T04:59:27.362635+00:00","problems":[{"fix":"In the node's TLS configuration, provide the correct CA certificate, or for development purposes, check 'Allow insecure TLS (self-signed, etc.)' (sets `rejectUnauthorized: false`) with caution.","cause":"The server's certificate chain could not be validated against the known trusted root certificates on the Node.js system. Often happens with self-signed certificates or corporate proxies.","error":"Error: unable to verify the first certificate"},{"fix":"Before accessing `msg.peerCertificate` properties, always include a check: `if (msg.peerCertificate && msg.peerCertificate.commonName) { ... }` in your function nodes.","cause":"Attempting to access a property of `msg.peerCertificate` (like `commonName`) when `msg.peerCertificate` itself is `undefined` because the HTTPS connection failed or no certificate was presented.","error":"Node-RED: [error] [https request:myNode] TypeError: Cannot read properties of undefined (reading 'commonName')"},{"fix":"Verify the URL and hostname are correctly spelled and accessible from the Node-RED instance's network. Check DNS settings if needed.","cause":"The hostname specified in the URL could not be resolved to an IP address, indicating a DNS issue or incorrect hostname.","error":"Error: getaddrinfo ENOTFOUND example.com"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/node-red-contrib-https","openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","web-framework","auth-security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}