Firebase emulator from local network - firebase

firebase command firebase emulators:start all ports and hosts work fine on my pc but but if I try from different device in my network (ohter pc) to access network-ip:8080 I get connection refused.
This does not worked:
firebase.firestore().useEmulator("0.0.0.0", 8080);
But this worked:
firebase.firestore().useEmulator("192.168.x.x", 8080);
Why first one was not working but second one worked did not understand the reason behind this

0.0.0.0 is not a valid destination address for outgoing connections, such as those being made by the Firebase SDK to connect to the emulator. It is only a valid incoming address for services that want to listen on all possible IP addresses assign to the machine where it's running.
I recommend doing a web search for "ip address 0.0.0.0" to read more.

Are you sure that the port that you are trying to connect to is opened? I ran through the same issue with Ubuntu firewall blocking the request. If you are using Ubuntu use this command to open the port.
sudo ufw allow 9299

Related

Using interconnect search-replace wordpress migration tool on Google CloudSQL

I recently migrated a site to a new server and am now trying to replace the old domain by the new one using this tool suggested in the wordpress codex.
The SQL instance and the VM are both in the same region and are connected using a cloud sql proxy, however when I try and connect to the database via the searc-replace tool, I get connection refused:
EDIT:
The command used to start the sql proxy is the following:
localhost:/cloudsql/project-name:region:sql-instance-name
It is the same I use in the config file to connect the site to the db.
"Connection Refused" error occurs when an application attempts a TCP connection but there is either no service listening on the target address and port or a firewall rejecting the connection.
First, lets make sure you are connecting on the right port. Run sudo netstat -lntp and look for cloud_sql_proxy. For example you might see
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 71313/cloud_sql_pro
indicating cloud sql is listening on port 3306. If you saw this, you should change the port in your tool to 3306.
If netstat does not show any cloud_sql_proxy line, then it isn't listening on TCP. While TCP isn't always needed for MySQL, it looks like the tool your are using does need it. Make sure you start cloud_sql_proxy with -instances=<INSTANCE_CONNECTION_NAME>=tcp:3306
Second, lets make sure you are connecting on the right address. This should be localhost without :/cloudsql/project-name:region:sql-instance-name after.
If it still doesn't work after those two, use sudo iptables -L to look for firewall rules blocking the traffic. I believe it's unlikely that you have a firewall stopping local traffic, however.
An alternative to using the Cloud SQL Proxy is to connect directly to your instance. To do this:
Find the external IP address of the VM you are running the PHP tool on.
Grant access for that IP address to your SQL instance, with the instructions here
Because MySQL can have different username/password depending on where you connect from, ensure there is a username/password combo for host %. instructions here.
Use the tool, with the username/password from (3), port=3306 and host=the IP address of your SQL instance
When you are done, remove access from the IP address to your Cloud SQL instance.

Meteor app on local network

I'm learning how to use Meteor by following the tutorial. I'm aware that Meteor automatically hosts the app to both localhost and my IPv4 address (in this instance, 192.168.1.100). When I visit 192.168.1.100:3000 on the computer it's hosted from, the app works fine, however it won't load on any other devices that access 192.168.1.100:3000 from the local network.
I've read the following answers:
Accessing meteor server on LAN
Accessing Meteor local web server from another local device on Mac 10.8
Meteor - accessing the app using public ip
How to run meteor server on a different ip address?
Start Meteor server and let other computers access it
And none of them worked for me. It may be because I'm running Windows. If that's the case, can anyone help on how to host the app on the local network?
There's a number of reasons why you may not be able to
try opening the port
netsh advfirewall firewall add rule name="Meteor 3000" dir=in action=allow protocol=TCP localport=3000
if connecting via wifi, then routers often disallow connections to other devices on the network, check router settings

Connect to Meteor using Robomongo

I have Meteor running on a local virtual machine on Windows which is accessible using the IP address of 192.168.56.111
When I use Robomongo, I use this IP address and point it to port 3001 and I an unable to connect.
Should I expect it to connect? If not, is there anything I need to do to get it to connect?
Setup SSH server on Windows and then simply create SSH tunnel:
ssh -L27018:192.168.56.111:3001 user#host
After that open Robomongo and connect to localhost:27018. That's it!
This technique I'm using successfully to connect to production database.
With meteor the database that runs is bound to 127.0.0.1, so it will not be accessible on other IPs. I think this was done for a security reason, though not sure.
You should use the local IP/127.0.0.1 instead of 192.168.56.11.

Connect to localhost with iPad

Trying to connect to localhost on my development machine with my iPad using wifi.
The webserver integrated in Visual studio.
Using ip number I get from ipconfig.
192.168.1.84:1144
I'm receiving http 400 error.
I've added port 1144 as TCP/IP port on firewall.
Anybody knows what I'm doing wrong?
does your machine have a static IP? with DHCP enabled, the ip of your machine keeps changing every now and then, so it might be the case that the address provided is no longer available!!
disconnect and reconnect to your network, then run ipconfig again and check if the IP has changed, if it has, then DHCP is enabled...

Meteor - accessing the app using public ip

I can access the app using localhost:3000 but I am trying to test from mobile devices locally, without having to deploy it. But I couldn't access the site.
I am allowing incoming request:
sudo ufw status verbose
Status: active
Logging: on (low)
Default: allow (incoming), allow (outgoing)
New profiles: skip
To Action From
-- ------ ----
3000/tcp ALLOW IN Anywhere
3000/tcp ALLOW IN Anywhere (v6)
I found that my ip address is 128.84.125.239 and so I visit 128.84.125.239:3000 and nothing happens.
This turned out to be an issue of using the right IP, or configuring the NAT of the router appropriately. Using a service such as cmyip.com will only provide you with your external IP address. This address can only reach your meteor app if your router is configured accordingly, i.e., the router will forward requests on port 3000 (or whichever port you are running your app on) to your server.
For testing on a mobile device during development you are most likely best off using your internal IP address, assuming your mobile device is on the same network as your app-serving machine.
On Linux you can use ifconfig to get your internal IPs. If you are connected via ethernet then you'll be looking for the device eth0 (in most cases). If you are connected over wifi, then the device you are looking for is typically called wlan0.
On Mac OSX you can use ifconfig as well, and look for devices called enX, where X is a number (often 0, or 2).
Your service is probably only running locally (on local ports, 127.0.0.0/8), To confirm this, run netstat -tulpn to see what services are running and on what ports/interfaces. If you don't see 0.0.0.0:3000 or 128.84.125.239:3000 then you won't be able to get ti it from the IP you are trying and you need to change the bind address of your app to be that IP (or all interaces).

Resources