Node.js v8.11.1 EPROTO error when attempting to POST using https module





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I have a system that is running on Node 8.11.1 on AWS. There is a function that writes logs to another server. This function takes a request object that it logs.



My problem arises during the actual POST attempt, giving me the following error:



Error: write EPROTO 139746875082624:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827:



I cannot see anything wrong with my code.
Why is the error occurring, and what can I do to fix it?



Here is the code inside of the function:



const https = require('https');    
try
{
const postData = "New log finished " + JSON.stringify(request, null, 2);

const options =
{
hostname: LOG_DOMAIN,
port: LOG_PORT,
path: '/',
method: 'POST'
};

const req = https.request(options);
req.on('error', (e) =>
{
console.error("ERROR writing logs: " + e);
});
req.write(postData);
req.end();
}
catch (e)
{
console.log(e);
}


LOG_DOMAIN and LOG_PORT are variables passed to the function.










share|improve this question

























  • What is the value of LOG_PORT?

    – Aravind Voggu
    Nov 16 '18 at 18:03











  • @AravindVoggu Excellent question. LOG_DOMAIN and LOG_PORT are variables passed to the function. I have updated the original post to reflect this.

    – JSBach
    Nov 17 '18 at 0:00











  • Yes they are, I'm looking for the 'value' :) . httpS uses port 443 and http only uses port 80. If LOG_PORT value is 80 and you try to use httpS, you can get an error like this. Can you check and confirm LOG_PORT is set to 443? Also post the value of LOG_DOMAIN while you are at it, just to be sure.

    – Aravind Voggu
    Nov 17 '18 at 3:14











  • @AravindVoggu I am posting to an ELK server which holds the logs, and I am using a port other than 443. I am reticent to post the actual domain for security purposes of my organization. That said, am I unable to securely post on a port besides 443? The domain expects another port, but I do not know if the Node module is limited to only that port.

    – JSBach
    Nov 17 '18 at 18:32






  • 1





    I will check with our platform team to see if there are any logs around that. @AravindVoggu I really appreciate your time!!

    – JSBach
    Nov 17 '18 at 19:16


















1















I have a system that is running on Node 8.11.1 on AWS. There is a function that writes logs to another server. This function takes a request object that it logs.



My problem arises during the actual POST attempt, giving me the following error:



Error: write EPROTO 139746875082624:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827:



I cannot see anything wrong with my code.
Why is the error occurring, and what can I do to fix it?



Here is the code inside of the function:



const https = require('https');    
try
{
const postData = "New log finished " + JSON.stringify(request, null, 2);

const options =
{
hostname: LOG_DOMAIN,
port: LOG_PORT,
path: '/',
method: 'POST'
};

const req = https.request(options);
req.on('error', (e) =>
{
console.error("ERROR writing logs: " + e);
});
req.write(postData);
req.end();
}
catch (e)
{
console.log(e);
}


LOG_DOMAIN and LOG_PORT are variables passed to the function.










share|improve this question

























  • What is the value of LOG_PORT?

    – Aravind Voggu
    Nov 16 '18 at 18:03











  • @AravindVoggu Excellent question. LOG_DOMAIN and LOG_PORT are variables passed to the function. I have updated the original post to reflect this.

    – JSBach
    Nov 17 '18 at 0:00











  • Yes they are, I'm looking for the 'value' :) . httpS uses port 443 and http only uses port 80. If LOG_PORT value is 80 and you try to use httpS, you can get an error like this. Can you check and confirm LOG_PORT is set to 443? Also post the value of LOG_DOMAIN while you are at it, just to be sure.

    – Aravind Voggu
    Nov 17 '18 at 3:14











  • @AravindVoggu I am posting to an ELK server which holds the logs, and I am using a port other than 443. I am reticent to post the actual domain for security purposes of my organization. That said, am I unable to securely post on a port besides 443? The domain expects another port, but I do not know if the Node module is limited to only that port.

    – JSBach
    Nov 17 '18 at 18:32






  • 1





    I will check with our platform team to see if there are any logs around that. @AravindVoggu I really appreciate your time!!

    – JSBach
    Nov 17 '18 at 19:16














1












1








1








I have a system that is running on Node 8.11.1 on AWS. There is a function that writes logs to another server. This function takes a request object that it logs.



My problem arises during the actual POST attempt, giving me the following error:



Error: write EPROTO 139746875082624:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827:



I cannot see anything wrong with my code.
Why is the error occurring, and what can I do to fix it?



Here is the code inside of the function:



const https = require('https');    
try
{
const postData = "New log finished " + JSON.stringify(request, null, 2);

const options =
{
hostname: LOG_DOMAIN,
port: LOG_PORT,
path: '/',
method: 'POST'
};

const req = https.request(options);
req.on('error', (e) =>
{
console.error("ERROR writing logs: " + e);
});
req.write(postData);
req.end();
}
catch (e)
{
console.log(e);
}


LOG_DOMAIN and LOG_PORT are variables passed to the function.










share|improve this question
















I have a system that is running on Node 8.11.1 on AWS. There is a function that writes logs to another server. This function takes a request object that it logs.



My problem arises during the actual POST attempt, giving me the following error:



Error: write EPROTO 139746875082624:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827:



I cannot see anything wrong with my code.
Why is the error occurring, and what can I do to fix it?



Here is the code inside of the function:



const https = require('https');    
try
{
const postData = "New log finished " + JSON.stringify(request, null, 2);

const options =
{
hostname: LOG_DOMAIN,
port: LOG_PORT,
path: '/',
method: 'POST'
};

const req = https.request(options);
req.on('error', (e) =>
{
console.error("ERROR writing logs: " + e);
});
req.write(postData);
req.end();
}
catch (e)
{
console.log(e);
}


LOG_DOMAIN and LOG_PORT are variables passed to the function.







node.js post https






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 23:59







JSBach

















asked Nov 16 '18 at 17:41









JSBachJSBach

85




85













  • What is the value of LOG_PORT?

    – Aravind Voggu
    Nov 16 '18 at 18:03











  • @AravindVoggu Excellent question. LOG_DOMAIN and LOG_PORT are variables passed to the function. I have updated the original post to reflect this.

    – JSBach
    Nov 17 '18 at 0:00











  • Yes they are, I'm looking for the 'value' :) . httpS uses port 443 and http only uses port 80. If LOG_PORT value is 80 and you try to use httpS, you can get an error like this. Can you check and confirm LOG_PORT is set to 443? Also post the value of LOG_DOMAIN while you are at it, just to be sure.

    – Aravind Voggu
    Nov 17 '18 at 3:14











  • @AravindVoggu I am posting to an ELK server which holds the logs, and I am using a port other than 443. I am reticent to post the actual domain for security purposes of my organization. That said, am I unable to securely post on a port besides 443? The domain expects another port, but I do not know if the Node module is limited to only that port.

    – JSBach
    Nov 17 '18 at 18:32






  • 1





    I will check with our platform team to see if there are any logs around that. @AravindVoggu I really appreciate your time!!

    – JSBach
    Nov 17 '18 at 19:16



















  • What is the value of LOG_PORT?

    – Aravind Voggu
    Nov 16 '18 at 18:03











  • @AravindVoggu Excellent question. LOG_DOMAIN and LOG_PORT are variables passed to the function. I have updated the original post to reflect this.

    – JSBach
    Nov 17 '18 at 0:00











  • Yes they are, I'm looking for the 'value' :) . httpS uses port 443 and http only uses port 80. If LOG_PORT value is 80 and you try to use httpS, you can get an error like this. Can you check and confirm LOG_PORT is set to 443? Also post the value of LOG_DOMAIN while you are at it, just to be sure.

    – Aravind Voggu
    Nov 17 '18 at 3:14











  • @AravindVoggu I am posting to an ELK server which holds the logs, and I am using a port other than 443. I am reticent to post the actual domain for security purposes of my organization. That said, am I unable to securely post on a port besides 443? The domain expects another port, but I do not know if the Node module is limited to only that port.

    – JSBach
    Nov 17 '18 at 18:32






  • 1





    I will check with our platform team to see if there are any logs around that. @AravindVoggu I really appreciate your time!!

    – JSBach
    Nov 17 '18 at 19:16

















What is the value of LOG_PORT?

– Aravind Voggu
Nov 16 '18 at 18:03





What is the value of LOG_PORT?

– Aravind Voggu
Nov 16 '18 at 18:03













@AravindVoggu Excellent question. LOG_DOMAIN and LOG_PORT are variables passed to the function. I have updated the original post to reflect this.

– JSBach
Nov 17 '18 at 0:00





@AravindVoggu Excellent question. LOG_DOMAIN and LOG_PORT are variables passed to the function. I have updated the original post to reflect this.

– JSBach
Nov 17 '18 at 0:00













Yes they are, I'm looking for the 'value' :) . httpS uses port 443 and http only uses port 80. If LOG_PORT value is 80 and you try to use httpS, you can get an error like this. Can you check and confirm LOG_PORT is set to 443? Also post the value of LOG_DOMAIN while you are at it, just to be sure.

– Aravind Voggu
Nov 17 '18 at 3:14





Yes they are, I'm looking for the 'value' :) . httpS uses port 443 and http only uses port 80. If LOG_PORT value is 80 and you try to use httpS, you can get an error like this. Can you check and confirm LOG_PORT is set to 443? Also post the value of LOG_DOMAIN while you are at it, just to be sure.

– Aravind Voggu
Nov 17 '18 at 3:14













@AravindVoggu I am posting to an ELK server which holds the logs, and I am using a port other than 443. I am reticent to post the actual domain for security purposes of my organization. That said, am I unable to securely post on a port besides 443? The domain expects another port, but I do not know if the Node module is limited to only that port.

– JSBach
Nov 17 '18 at 18:32





@AravindVoggu I am posting to an ELK server which holds the logs, and I am using a port other than 443. I am reticent to post the actual domain for security purposes of my organization. That said, am I unable to securely post on a port besides 443? The domain expects another port, but I do not know if the Node module is limited to only that port.

– JSBach
Nov 17 '18 at 18:32




1




1





I will check with our platform team to see if there are any logs around that. @AravindVoggu I really appreciate your time!!

– JSBach
Nov 17 '18 at 19:16





I will check with our platform team to see if there are any logs around that. @AravindVoggu I really appreciate your time!!

– JSBach
Nov 17 '18 at 19:16












1 Answer
1






active

oldest

votes


















0














After further research, it appears that Aravind Voggu (see comments) was in the right vein: the error comes from attempts to use HTTPS for a server that only allows HTTP.



The OpenSSL dies when attempting to secure a connection to something that is unsecured.



The only change required to make my code work correctly was to remove the "s" from "https" in the locations used.



const http = require("http");





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53342860%2fnode-js-v8-11-1-eproto-error-when-attempting-to-post-using-https-module%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    After further research, it appears that Aravind Voggu (see comments) was in the right vein: the error comes from attempts to use HTTPS for a server that only allows HTTP.



    The OpenSSL dies when attempting to secure a connection to something that is unsecured.



    The only change required to make my code work correctly was to remove the "s" from "https" in the locations used.



    const http = require("http");





    share|improve this answer




























      0














      After further research, it appears that Aravind Voggu (see comments) was in the right vein: the error comes from attempts to use HTTPS for a server that only allows HTTP.



      The OpenSSL dies when attempting to secure a connection to something that is unsecured.



      The only change required to make my code work correctly was to remove the "s" from "https" in the locations used.



      const http = require("http");





      share|improve this answer


























        0












        0








        0







        After further research, it appears that Aravind Voggu (see comments) was in the right vein: the error comes from attempts to use HTTPS for a server that only allows HTTP.



        The OpenSSL dies when attempting to secure a connection to something that is unsecured.



        The only change required to make my code work correctly was to remove the "s" from "https" in the locations used.



        const http = require("http");





        share|improve this answer













        After further research, it appears that Aravind Voggu (see comments) was in the right vein: the error comes from attempts to use HTTPS for a server that only allows HTTP.



        The OpenSSL dies when attempting to secure a connection to something that is unsecured.



        The only change required to make my code work correctly was to remove the "s" from "https" in the locations used.



        const http = require("http");






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 26 '18 at 21:29









        JSBachJSBach

        85




        85
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53342860%2fnode-js-v8-11-1-eproto-error-when-attempting-to-post-using-https-module%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Xamarin.iOS Cant Deploy on Iphone

            Glorious Revolution

            Dulmage-Mendelsohn matrix decomposition in Python