Getting "unable to get local issuer certificate" from discord api, when cloudflare zero trust is on

Throwing “unable to get local issuer certificate” error when trying to run a discord bot. I faced a similar issue with git and few other applications/websites. Luckily, with git, it was solved with a single command git config --global http.sslbackend schannel. What is the cause of this error? How can I remove it?

[project/bot.js] {
  "name": "FetchError",
  "code": 500,
  "method": "get",
  "path": "/gateway/bot",
  "requestData": {
    "files": []
  }
} 
FetchError: request to https://discord.com/api/v9/gateway/bot failed, reason: unable to get local issuer certificate
    at RequestHandler.execute (D:\Projects\si-midnightron\node_modules\discord.js\src\rest\RequestHandler.js:200:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (D:\Projects\si-midnightron\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
    at async WebSocketManager.connect (D:\Projects\si-midnightron\node_modules\discord.js\src\client\websocket\WebSocketManager.js:133:9)
    at async Client.login (D:\Projects\si-midnightron\node_modules\discord.js\src\client\Client.js:252:7)
```6/23/2022, 3:39:06 PM - info: [project/bot.js] Running on port 3000 
6/23/2022, 3:39:07 PM - error: [project/bot.js] {
  "name": "FetchError",
  "code": 500,
  "method": "get",
  "path": "/gateway/bot",
  "requestData": {
    "files": []
  }
} 
FetchError: request to https://discord.com/api/v9/gateway/bot failed, reason: unable to get local issuer certificate
    at RequestHandler.execute (D:\Projects\si-midnightron\node_modules\discord.js\src\rest\RequestHandler.js:200:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (D:\Projects\si-midnightron\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
    at async WebSocketManager.connect (D:\Projects\si-midnightron\node_modules\discord.js\src\client\websocket\WebSocketManager.js:133:9)
    at async Client.login (D:\Projects\si-midnightron\node_modules\discord.js\src\client\Client.js:252:7)

Look like you’re using Node.JS for the bot
Try executing this command:
npm config set strict-ssl false

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.