Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1611

Why would I be getting `Error: write EPROTO` when making an HTTPS request in an Electron app?

$
0
0

I've been pounding my head against the wall for days on this so I am turning to the smart folks at Stackoverflow to help. Here's the deal:

System Details

  • Node Version (can't be changed due to Electron dependencies): v4.1.1
  • Electron Version: v0.34.3
  • OS Version: Mac OSX Yosemite 10.10.5 (14F1021)

Issue Description

I'm building an Electron app that has to communicate with my company's application server. The server connection has to go over HTTPS. I'm using Node's built-in https module. When making a request to the server I'm getting the following error:

{ [Error: write EPROTO] code: 'EPROTO', errno: 'EPROTO', syscall: 'write', address: undefined }

I've done a ton of Googling on this and most everything I've found points to proxies but I'm not using a proxy. I've tried the following:

  • Setting rejectUnauthorized: false in the options hash
  • Modifying the secureProtocol option (no results)
  • Attempting to set the --tls-cipher-list (no idea what I'm doing there)

I can make the request over curl without issue. Unfortunately, I can't post the actual URL I'm making requests to.

Sample Code

Here's some sample code (Coffeescript) that illustrates the issue:

https = require 'https'options = {  host: '[Application URL]'  path: '/'  method: 'GET'  port: 443}options.agent = new https.Agent(options)callback = (response) ->  str = ''  console.log response  console.log "STATUS: #{response.statusCode}"  console.log "HEADERS: #{JSON.stringify(response.headers)}"  response.setEncoding 'utf-8'  response.on 'data', (chunk) -> str += chunk  response.on 'end', -> console.log strmakeRequest = ->  req = https.request options, callback  req.on 'error', (err) ->    console.log err  req.end()makeRequest()

Does anyone have any idea what could be causing this issue? Is it a Node issue or something with the configuration of the application server? This bug is killing me and preventing me from hitting a milestone at work so any help would be greatly appreciated. Thanks!


Viewing all articles
Browse latest Browse all 1611

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>