Jonathan Allen Grant Jonathan Allen Grant - 1 month ago 11x
Node.js Question

When I try to do a https post request in node, I get a getaddrinfo ENOTFOUND error

The full error is this:

throw er; // Unhandled 'error' event

Error: getaddrinfo ENOTFOUND
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:79:26)

and my code to get just the error is this:

var express = require('express');
var app = express();
var https = require('https');

app.get('/oauth/ig', function (req, res) {
var options = {
hostname: '',
path: '/oauth/access_token?client_secret=myClientSecret&grant_type=authorization_code&redirect_uri=http://localhost:1992/oauth/ig&code='+req.query.code,
method: 'POST',
var igRequest = https.request(options, (response) => {
res.send("fuck it");

I am using nodejs and am trying to do the Instagram OAUTH.


hostname should be just the host name, not including the protocol:

hostname: '',