Cypress test not starting and throwing handshake error in console - cypress

I am trying to follow the getting started guide at https://docs.cypress.io/guides/getting-started/installing-cypress.html#System-requirements and when I run the following command
npx cypress open
it opens a popup and lists all the example specs. For now I am just running the example specs but this where I am facing the issue. It opens a browser but the page is just blank and I see the following error in the console,
Websocket connection to
'ws://localhost:62083/__socket.io/?EIO=3&transport=websocket' failed:
Connection closed before receiving a handshake response
I tested the same app in another machine and it works but its not working on my machine. Is there something that is causing the issue. My laptop is an office laptop is behind proxy. I checked the cypress proxy setting and I see that the proxy is correctly configured.

I had the same issue on my mac and this comment from filiphric solved the problem: https://github.com/cypress-io/cypress/issues/1239#issuecomment-419657694
open terminal, type: sudo nano /etc/hosts
if nothing is present, input defaults:
##
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
save and close. (ctrl + X then y then enter)
reopen cypress and all should work normally
Hope it can help you too!

Related

Mac OS local proxy, connect ECONNREFUSED ::1:3000

I have a create-react-app app running on localhost:3000 and a proxy server running on localhost:4000 that redirects some of my request to port 3000.
Requesting localhost:3000/ correctly returns index.html file,
Requesting localhost:4000/ returns connect ECONNREFUSED ::1:3000 with 502 code.
The exact same setup works properly on Ubuntu (returns index.html from localhost:4000) and Windows so I am sure proxy works fine.
Proxy is built using https://www.npmjs.com/package/http-proxy but i was unable to find any solution to this in documentation.
My question is: Does mac require changing some extra settings to allow this kind of traffic?
One solution is to edit /etc/hosts and remove ::1 localhost mapping or change it to ::1 ip6-localhost (default setting on ubuntu)

Unable to push Docker images to local registry, client times out

I'm writing as I've encountered an issue that doesn't seem to get resolved, would value the community's help.
I'm trying to push an image to a local registry I deployed on port 5000.
When I use this command docker push localhost:5000/explorecalifornia.com to push the image to my local registry, I get the following message
Get "http://localhost:5000/v2/": net/http: request canceled (Client.Timeout exceeded while awaiting headers)
I've confirmed the registry is on port 5000 by using GET on postman, and I get a valid, expected {} response (since there's no images currently on my local registry).
I've since tried to fix this by updating my etc/hosts file to comment out "::1 localhost" per advise of this post. This is the contents of my etc/hosts file
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
# ::1 localhost
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
I also updated my etc/resolve.conf file with the following nameservers per advise from this post.
nameserver 10.0.2.3
nameserver 8.8.8.8
nameserver 8.8.4.4
None of this worked. Did anyone also encounter this issue? Is there any recommendations to help fix this issue?
Here's the source code if it helps! Thank you in advance :)
You may have a HTTP proxy defined. Please try running these commands.
unset http_proxy
unset https_proxy
I think there must be sth changed with the kind image. I use the script from this page:
https://kind.sigs.k8s.io/docs/user/local-registry/
I am able to create a new kind cluster and registry. After that, I have no problem following the video lecture to push the explorecalifornia.com image to the local registry.
I use a work-around for this error and it is as below:
Firstly, tag the images using the localhost ip instead, ie
docker tag imagename 127.0.0.1:5000/imagename
and,
docker push 127.0.0.1:5000/imagename
I hope this works for you as well.

MacOS doesn't resolve localhost to 127.0.0.1 (ignores hosts / apache vhosts)

I ran into the problem, that localhost redirects to a specific domain instead of 127.0.0.1.
My configuration is a local apache/mysql/php installation on MacOS Mojave using vhosts for different projects that are configured in hosts to redirect properly.
When I enter 127.0.0.1 in any browser, I get to my overview page lying in the www root. The same should happen, when I enter localhost in the browser, but instead it redirects to a domain of a project I was working on in the past. It happens also without network connection, so the configuration is on this machine.
My /etc/hosts file:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost project1.local project2.local
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
The first line seems to be ignored and localhost doesn't resolve to 127.0.0.1.
I only have two vhost configurations plus default configuration with no wrong redirection and also the httpd.conf lookes fine. I searched the whole machine with grep -lr "redirectiondomain.com" * without results. I tried with apache switched off with the same result and looked up the MacOS network settings but I can't find anything related to the wrong redirection neither any other solution on stackoverflow or google that solves my issue. Has anybody a clue how the wrong redirection of localhost could be set somewhere else?
Edit: My hostname in MacOS is set. I tried localhost without port, with :80 and :8080

Safari can’t connect to the server local host

Whenever I start Tomcat, and open http://localhost:8080 I get the following error.
Safari can’t open the page “localhost:8080” because Safari can’t connect to the server “localhost”.
It used to work before today. All I did earlier today was block some websites using the host files, but I restored them back again, and now it looks like this.
#
##
# Host Database
#
#
# localhost is used to configure the lookback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
If I start and stop the server using Eclipse, it works. But localhost can’t connect to server using Safari or Google Chrome either..
I know there are a lot of similar questions, but none of them seemed to help.
Thanks a lot in advance!

gethostbyname fail after switching internet connections

I often (but not always) get the following error when running MPI jobs after switching wifi hosts.
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(498)..............:
MPID_Init(187).....................: channel initialization failed
MPIDI_CH3_Init(89).................:
MPID_nem_init(320).................:
MPID_nem_tcp_init(171).............:
MPID_nem_tcp_get_business_card(418):
MPID_nem_tcp_init(377).............: gethostbyname failed, MacBook-Pro.local (errno 1)
Everything works fine in the coffee shop, and then when I come home, I get the above error. Nothing else has changed.
I've checked the /etc/hosts and /private/etc/hosts files, and they look okay -
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
I can ping localhost, so the problem isn't exactly that localhost isn't resolved.
Rebooting always fixes the problem, but is there something simple I can do to "reset" my system so that it recognizes local host?
I don't have access to the details of the MPI initialization routines in the code I am running and am not making any explicit calls to gethostname.
I am using MPICH 3.1.4 (built Feb, 2015) and am running OSX 10.10.3
The answer is very simple - here is what seems to work.
I edited the file /etc/hosts (or /private/etc/hosts, in OSX) and added the line
127.0.0.1 macbook-pro.local
so now my hosts files looks like :
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
127.0.0.1 macbook-pro.local
We were facing this issue intermittently on our CI server. It seems that setting the environment variable MPICH_INTERFACE_HOSTNAME to localhost helped.

Resources