HubSpot/hubspot-api-nodejs

ERROR CERT_HAS_EXPIRED

michaelsilvapp opened this issue · 5 comments

I'm getting a very strange error and I don't know how to solve it, I've already updated the package and it still persists

{ FetchError: request to https://api.hubapi.com/crm/v3/objects/companies/search failed, reason: certificate has expired
at ClientRequest. (/built_app/programs/server/npm/node_modules/node-fetch/lib/index.js:1501:11)
at emitOne (events.js:115:13)
at ClientRequest.emit (events.js:210:7)
at TLSSocket.socketErrorListener (_http_client.js:401:9)
at emitOne (events.js:115:13)
at TLSSocket.emit (events.js:210:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
=> awaited here:
at Function.Promise.await (/built_app/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:56:12)
at Promise.asyncApply (server/Hubspot/services/company.service.js:34:19)
at /built_app/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/fiber_pool.js:43:40
message: 'request to https://api.hubapi.com/crm/v3/objects/companies/search failed, reason: certificate has expired',
type: 'system',
errno: 'CERT_HAS_EXPIRED',
code: 'CERT_HAS_EXPIRED' }

@michaelsilvapp are you still having the same problem? Running into it on my end as well and was curious if you found a solution for it.

Hi everyone.
I can't reproduce it.
I've checked HubSpot SSL cert and it is valid (link to test).
Could you share a solution here when you solve it, please?
What version of the SDK and node.js do you use?

Hello I had to switch to https calls I got rid of the SDK.

and in calls I had to do the following:

import https from "https";

const agent = new https.Agent({
    rejectUnauthorized: false
});


 await axios.get(url, {
      headers: {  Authorization: `Bearer XXXXXXX` },
      httpsAgent: agent })

but making this clear and a Hubspot bug, they have some outdated certificate.

Changes of HubSpot SSL.

This article says that HubSpot have migrated to Let's Encrypt.
I've checked HubSpot SSL cert and it is valid (link to test).
The article recommends: Update Node.js and use a recent version of Node.js, including the latest CA certificates.