Open PaoloOranges opened 1 year ago
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
@PaoloOranges I just tried connecting to localhost using your code and wasn't able to reproduce the issue. Out of curiosity, are you able to start up another HTTP server and access it through localhost?
Hi @maneesht . Actually I haven't tried what you said. I'm going to test it. However I have to add that:
const firestoreDB = getFirestore();
connectFirestoreEmulator(firestoreDB, 'localhost', 8080);
works perfectly.
But if I use http.request()
with localhost
it fails too while it works with 127.0.0.1
.
e.g. (to call the URL to clean local firestore db) the following code return me the same error code connect ECONNREFUSED ::1:8080
const requestOptions =
{
host: 'localhost',
port: 8080,
method: 'DELETE',
path: CLEAN_FIRESTORE_PATH
};
const req = http.request(requestOptions, (res) => {
//...
}).on('error', (err) =>
{
//...
});
req.end();
while the following one completes with no error:
const requestOptions =
{
host: '127.0.0.1',
port: 8080,
method: 'DELETE',
path: CLEAN_FIRESTORE_PATH
};
const req = http.request(requestOptions, (res) => {
//...
}).on('error', (err) =>
{
//...
});
req.end();
Also, postman requests via localhost
to the emulator work.
I've just tried to start a local server (nodejs) and I can connect to localhost
with no problem.
I have very similar error with firestore emulator and set()
call. It only happens in cypress and never on actual browser. I use version 8 of firebase. Request is ok but data is never written on db and promise never resolves
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
When call
connectDatabaseEmulator
with parameterlocalhost
, to use emulator suite:set()
function fromfirebase/database
does not resolve and no writing is done on the database. If127.0.0.1
is used instead, logic works as expectedSteps to reproduce:
connectDatabaseEmulator
to bind the realtime database reference to the local emulatorset()
to write to the databaseExpected Result: Data are written to the real time database (local emulator); promise is resolved.
Actual Result: No data is written to DB, neither Resolve nor Error callbacks are called.
Relevant Code:
Output from Log:
NOTE : I replaced my project name with
<project-id>