Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

getaddrinfo ENOTFOUND https://project.app #26

Closed
pderiy opened this issue Sep 10, 2016 · 16 comments
Closed

getaddrinfo ENOTFOUND https://project.app #26

pderiy opened this issue Sep 10, 2016 · 16 comments
Labels

Comments

@pderiy
Copy link
Contributor

pderiy commented Sep 10, 2016

image

{ "appKey": "90mf4eojc6ogu4sfpg4g12i9escptj68p1qg2iu34rmnr09d58lj7f5h4j4g", "authEndpoint": "/broadcasting/auth", "authHost": null, "database": "sqlite", "databaseConfig": { "redis": {}, "sqlite": { "databasePath": "/database/laravel-echo-server.sqlite" } }, "devMode": false, "host": "https://project.app", "port": "6001", "referrers": [ { "host": "pasta-masta.app", "apiKey": "44ter5dm3isq6p89f8s1ufufkfo4jddun22ijbga617sedige4lsj9c8mc0r" } ], "sslCertPath": "/home/user/.valet/Certificates/pasta-masta.app.crt", "sslKeyPath": "/home/user/.valet/Certificates/pasta-masta.app.key" }

The problem is with host attribute. It works without "https://" prefix. But I need SSL.

@tlaverdure
Copy link
Owner

Is that immediately after startup? Or did you try and perform an action that caused that to occur?

@tlaverdure
Copy link
Owner

Your ssl files also don't match your host.

@pderiy
Copy link
Contributor Author

pderiy commented Sep 10, 2016

It happens just after startup.
Just try to add https prefix and you will have same problem.
Ssl files does match my host. I wanted to change my host url, but forget to change ssl files names.

@sgtaziz
Copy link

sgtaziz commented Sep 10, 2016

I'm experiencing the same problem as well. My host matches my crt and key. Using "host": "https://dev.horizonservers.net"
Was working fine prior to updating to 1.0

@sgtaziz
Copy link

sgtaziz commented Sep 10, 2016

It also causes the same issue when using http://.
After looking into it, it seems like the http module doesn't like protocols in its options. I temporarily fixed it by removing "https://" and "http://" in options.host under the httpServer function in server.js.

@jonnywilliamson
Copy link
Contributor

I'm having the same issue.

Initially I thought it was because I was running node 5 (see other thread). But I upgraded to Node 6.5.0 and I'm still getting this on homestead. Here's a print out of my shell:


22:31:02 ✔ vagrant@homestead $ npm -v
3.10.3

[~/Code/new.wn.dev]
22:31:04 ✔ vagrant@homestead $ node -v
v6.5.0

[~/Code/new.wn.dev]
22:31:07 ✔ vagrant@homestead $ npm outdated

[~/Code/new.wn.dev]
22:31:13 ✔ vagrant@homestead $ npm ls laravel-echo-server
/home/vagrant/Code/new.wn.dev
└── laravel-echo-server@1.0.1

[~/Code/new.wn.dev]
22:31:28 ✔ vagrant@homestead $ cat laravel-echo-server.json
{
        "appKey": "drmgqfube6b4t<snip>n86gtjqpqjc6u1j7d",
        "authEndpoint": "/broadcasting/auth",
        "authHost": "http://new.wn.dev",
        "database": "redis",
        "databaseConfig": {
                "redis": {},
                "sqlite": {
                        "databasePath": "/database/laravel-echo-server.sqlite"
                }
        },
        "devMode": false,
        "host": "http://new.wn.dev",
        "port": "6001",
        "protocol": "http",
        "referrers": [],
        "sslCertPath": "",
        "sslKeyPath": "",
        "verifyAuthPath": true,
        "verifyAuthServer": false
}[~/Code/new.wn.dev]


22:31:54 ✔ vagrant@homestead $ laravel-echo-server start

L A R A V E L  E C H O  S E R V E R

Starting server...

✔ Running at http://new.wn.dev on port 6001
✔ Channels are ready.
✔ Listening for redis events...
✔ Listening for http events...

Server ready!

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND http://new.wn.dev
    at errnoException (dns.js:28:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)

Looks like its including the http or https is causing this issue:

http://stackoverflow.com/questions/17690803/node-js-getaddrinfo-enotfound

@Thaars
Copy link

Thaars commented Sep 20, 2016

I'm using MAMP to manage my hosts, so a non-port-80-request is not handled by MAMP. That means, the dns record doesn't exist. But Node is checking for the existence and throws an error.

The Server.serverProtocol() method is setting the secure flag by checking the host option. Without https:// in the host option, it will always start a http server.

I changed the condition to (this.options.protocol == 'https') to determine if a http or a https server should be used. The https:// prefix is not needed in the host option anymore.

That works for me.

@jonnywilliamson
Copy link
Contributor

jonnywilliamson commented Sep 20, 2016

@Thaars

Just confirming you mean you changed this line https://github.com/tlaverdure/laravel-echo-server/blob/master/src/server.ts#L49

To

if (this.options.protocol == 'https') {

Then you dropped using any protocol in the json file for the host key so it looks like this?

{
        "appKey": "",
        "authEndpoint": "/broadcasting/auth",
        "authHost": "http://example.com",
\\<snip>
        "devMode": false,
        "host": "example.com",
        "port": "6001",
        "protocol": "http"
}

Thanks!

@Thaars
Copy link

Thaars commented Sep 20, 2016

No, the protocol option is still needed, but you don't need the protocol in the host option anymore. This is a part of my json config.

{
    "host": "example.local",
    "port": "6001",
    "protocol": "https"
}

@jonnywilliamson
Copy link
Contributor

Although I wrote it wrong above, (now fixed) that's actually what I meant in the first place! 😆

Thank you!

@pderiy
Copy link
Contributor Author

pderiy commented Sep 21, 2016

@jonnywilliamson can you add PR?

@pderiy pderiy closed this as completed Sep 24, 2016
@pderiy pderiy reopened this Sep 24, 2016
@pderiy
Copy link
Contributor Author

pderiy commented Sep 24, 2016

@tlaverdure this answer fixed my issue. Can you apply these changes?

@jonnywilliamson
Copy link
Contributor

@pderiy Sure #46

@tlaverdure
Copy link
Owner

Merge. @pderiy let me know if that closes this.

@pderiy
Copy link
Contributor Author

pderiy commented Sep 29, 2016

It works great. Thank you guys.

@tlaverdure , @jonnywilliamson

@pderiy pderiy closed this as completed Sep 29, 2016
@kokokele
Copy link

you havenot host for '127.0.0.1 localhost'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants