Error parsing cert retrieved from AIA (as DER) & ERROR: Couldn't read tbsCertificate as SEQUENCE & ERROR: Failed parsing Certificate using Electron

I am getting this error when my Electron application tries to use SSL/TLS to communicate with a server. This is not a duplicate of 75771237. Problem 75771237 was a Selenium problem with a Selenium solution that does not apply to this problem. Folks using Selenium have reported a very similar error. The fixes for the Selenium problem do not seem to work for Electron (or I am using them incorrectly). I am not sure if this is an Electron problem, an application problem, and/or a SSL/TLS problem. My package.json file follows

{
  "name": "your-app",
  "version": "1.0.0",
  "description": "",
  "main": "electronMain.js",
  "scripts": {
    "start": "electron .",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "electron": "^8.2.5"
  },
  "dependencies": {
    "electron-packager": "^14.2.1",
    "ws": "^7.2.5"
  }
}

My electronMain.js file follows

const { app, BrowserWindow } = require('electron');

function createWindow () {
  // Create the browser window.
  let win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true,
      contextIsolation: false,
      enableRemoteModule: true
    }
  })
    
  // and load the index.html of the app.
  win.loadFile('index.html')
}

app.commandLine.appendSwitch('ignore-certificate-errors')
app.commandLine.appendSwitch('-ignore-certificate-errors')
app.commandLine.appendSwitch('--ignore-certificate-errors')
app.commandLine.appendSwitch('allow-insecure-localhost', 'true')

app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
    event.preventDefault();
    callback(true);
});

app.allowRendererProcessReuse = true;
app.whenReady().then(createWindow)

Error Message:

\Users\XXX\Documents\Visual Studio Code\Projects\WebApplication5\WebApplication5>electron .
[17720:1105/165617 .503 : ERROR: cert_issuer_source_aia.cc(36)] Error parsing cert retrieved from AIA (as DER):
“RROR: Couldn't read tbsCertificate as SEQUENCE
ROR: Failed parsing Certificate

What am I doing wrong? How can I get rid of this error message?

0

There are 0 best solutions below