Error: Server Error. connect ETIMEDOUT 104.197.85.31:443 - firebase

i am using firebase cli and i try the following
$ firebase init
the cli continue with the message :
You're about to initialize a Firebase project in this directory:
c:\Dev\Test
are you ready to proceed ?
i type y
and choose Hosting:Configure and deploy Firebase Hosting sites
after few second i get the error
Error: Server Error. connect ETIMEDOUT 104.197.85.31:443
what can be the problem ?
my Enviroment specification:
CLI Version: 3.9.1
Platform: win32
Node Version: v7.10.0
Time:Thu Jun 08 2017 18:03:14 GMT+0430 (Iran Daylight Time)
i am useing PSIPHONE also as a proxy but i have also tried without PSIPHONE .
in both cases i get connection timeout
i have pinged 104.197.85.31 the connection is ok .
any suggestion to solve the issue ?
is it because i am in IRAN ?

Just close your terminal and re-run these commands.
firebase login
and now try again
firebase deploy --only hosting
It works for me!!!

I don't know why this is the first result on google but the second result had the answer:
https://stackoverflow.com/a/63832234/3393964
npm i -g firebase-tools
Updating firebase tools worked for me. then, try again firebase deploy.
if it still didn't work try clearing the firebase cache which is the .firebase file

It's on the Firebase's end. You can check status here.

In my case, my work PC started blocking Firebase deploys (Even on my mobile network).
Deploying from my home PC worked just fine.

Related

"invalid source token" while deploying a function to fireabse

i got wired issued with firebase deployment using:
firebase deploy -P dev
the error is
✔ functions[testFunction(us-central1)] Successful update operation.
Invalid source token
looks like its happen to new functions that created
when i tried to deploy specific function using:
firebase -deploy -P dev --only functions:name
its working
when i run and deploy all functions and all my apps i am getting the above error with no information
also the logs from google cloud function is:
status: {
code: 9
message: "Invalid source token"
}
firebase tools version 11.0.0
node: 14.19.3
I would suggest upgrading to atleast node 16 as there's an open issue regarding the "Invalid Source Token" on your current firebase-tools version. There's already a pull request regarding that issue and it will be fixed on the upcoming updates. Here's the github issue for reference.

Cloud Run Run/Debug has stopped working - Exited with code 127

The cloudrun debug in cloud shell was working. It is no longer working for me with the following output.
I have 1) rebooted the VM and 2) I have tried another project that was also working previously.
I suspect something has changed in my environment
Starting to debug the app using configuration 'Cloud Run: Run/Debug
Locally' from .vscode/launch.json... To view more detailed logs, go to
Output channel : "Cloud Run: Run/Debug Locally - Detailed" Dependency
check started Dependency check succeeded Unpausing minikube flag needs
an argument: --status-check See 'skaffold debug --help' for usage.
Exited with code 127. Cleaning up... Finished clean up.
This bug was introduced in the v1.17.1 release of Cloud Code for VS Code, due to a change in v1.37.0 of Skaffold related to the --status-check parameter. This bug was addressed in v1.17.2 of Cloud Code for VS Code, and upgrading to this version (or later) should fix this issue.

How to configure the GAE Datastore emulator on Windows?

Following the docs I have started the GAE Datastore Emulator from a CMD shell.
I used:
gcloud beta emulators datastore start --data-dir=j:\projects\project\datastore
The output is:
WARNING: Reusing existing data in [j:\projects\project\datastore].
Executing: cmd /c C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\cloud-datastore-emulator\cloud_datastore_emulator.cmd start --host=localhost --port=8081 --store_on_disk=True --consistency=0.9 --allow_remote_shutdown j:\projects\project\datastore
[datastore] Jun 08, 2019 5:24:52 PM com.google.cloud.datastore.emulator.CloudDatastore$FakeDatastoreAction$9 apply
[datastore] INFO: Provided --allow_remote_shutdown to start command which is no longer necessary.
[datastore] Jun 08, 2019 5:24:52 PM com.google.cloud.datastore.emulator.impl.LocalDatastoreFileStub <init>
[datastore] INFO: Local Datastore initialized:
[datastore] Type: High Replication
[datastore] Storage: j:\projects\jupiter\datastore\WEB-INF\appengine-generated\local_db.bin
[datastore] Jun 08, 2019 5:24:53 PM com.google.cloud.datastore.emulator.impl.LocalDatastoreFileStub load
[datastore] INFO: The backing store, j:\projects\project\datastore\WEB-INF\appengine-generated\local_db.bin, does not exist. It will be created.
[datastore] API endpoint: http://localhost:8081
[datastore] If you are using a library that supports the DATASTORE_EMULATOR_HOST environment variable, run:
[datastore]
[datastore] export DATASTORE_EMULATOR_HOST=localhost:8081
[datastore]
[datastore] Dev App Server is now running.
[datastore]
[datastore] The previous line was printed for backwards compatibility only.
[datastore] If your tests rely on it to confirm emulator startup,
[datastore] please migrate to the emulator health check endpoint (/). Thank you!
Browsing to localhost:8081 returns Ok
In a second CMD shell I try:
gcloud beta emulators datastore env-init --data-dir=j:\projects\project\datastore > set_vars.cmd && set_vars.cmd
(Google docs don't mention --data-dir=j:\projects\project\datastore but without it the tool looks in the wrong place)
But it fails with:
ERROR: (gcloud.beta.emulators.datastore.env-init) Unable to find env.yaml in the data_dir
[C:\Users\c\AppData\Roaming\gcloud\emulators\datastore]. Please ensure you have started the appropriate emulator.
If I set-up the environment variables manually I get the same results from my CMD shells.
I have tried to reproduced your use case scenario and it worked for me. This is what I have followed:
From Running the Datastore mode Emulator documentation.
Make sure that A Java JRE (version 8 or greater) is installed.
Install the Google Cloud SDK (If already have, update it)
Run the CMD as administrator
Execute $ gcloud components install cloud-datastore-emulator
Exectue $ gcloud beta emulators datastore start --data-dir=C:\PATH\TO\datastore
If get You do not currently have this command group installed. Using it requires the installation of components: [beta]
Then execute $ gcloud components install beta
Execute again $ gcloud beta emulators datastore start --data-dir=C:\PATH\TO\datastore
Open new CMD again as administrator
Execute $ gcloud beta emulators datastore env-init --data-dir=C:\PATH\TO\datastore > set_vars.cmd && set_vars.cmd
The command executed without any issues. This is the response:
C:\Windows\system32>set DATASTORE_DATASET=[PROJECT_ID]
C:\Windows\system32>set DATASTORE_EMULATOR_HOST=localhost:8081
C:\Windows\system32>set DATASTORE_EMULATOR_HOST_PATH=localhost:8081/datastore
C:\Windows\system32>set DATASTORE_HOST=http://localhost:8081
C:\Windows\system32>set DATASTORE_PROJECT_ID=[PROJECT_ID]
C:\Windows\system32>
I would suggest to try the process again from different directory. Make sure that:
You have admin permissions to access the directory.
For testing purposes, try a directory in your desktop.
Update the Google Cloud SDK.
The directory's path don't have a space in it.
Both CMDs should open with administrative privileges.
UPDATED 2019-09-07 following comments.
If you are stuck with Google App Engine (GAE) Standard Python 2.7, and have to run local version of GDS, here is my way of doing it (thought not an answer directly to the question, but still might be relevant to).
I run dev_appengine with datastore parameters. on windows the .bat file might look like this:
set PY="c:\/python27\/python.exe"
set GAE="C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py"
set GCSEMU="C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\cloud-datastore-emulator\cloud_datastore_emulator.cmd"
%PY% %GAE% --skip_sdk_update_check=True --datastore_emulator_cmd=%GCSEMU% --port 8080 --host oe.loc .
There are parameters for store location too.

Firebase Functions Error while deploying to emulator

I'm trying to start new Firebase Functions project using latest versions of packages.
I've followed this tutorial https://youtu.be/DYfP-UIKxH0:
Firebase login
Firebase init
Created functions project the same way as tutorial says
Uncommented index.ts content
After that I get this error:
Starting #google-cloud/functions-emulator
[2018-04-04T19:05:12.124Z] Parsing function triggers
[2018-04-04T19:05:12.404Z] Error while deploying to emulator: TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
at Promise (/usr/local/lib/node_modules/firebase-tools/node_modules/#google-cloud/functions-emulator/src/client/rest-client.js:34:42)
at getService.then (/usr/local/lib/node_modules/firebase-tools/node_modules/#google-cloud/functions-emulator/src/client/rest-client.js:33:16)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
⚠ functions: Failed to emulate helloWorld
I have latest functions emulator *1.0.0-beta4.
All other libs are in latest versions...
I'm at point where I have no idea how to debug this better and how to resolve this
This error occurs if an existing process listens on port 5000. Double check if there's a process running, e.g. on Mac OS Sierra
sudo lsof -n -iTCP:5000 | grep LISTEN
Stop this process or run firebase on another port, e.g.
firebase -p 7777 serve --only functions
No need to reinstall packages. Error message is not helpful and we spent some time to find the root cause.
It turned out that it was due other app that was listening on port 5001!
Firebase serve stops with some weird message.
Just check as answer below if ports aren't busy

Firebase - Error adding a new project: unable to get local issuer certificate

I'm trying to develop and deploy some firebase cloud functions using the firebase cli on Windows 7. I'm trying to set up my development environment from my office where the network is behind a corporate proxy.
In the past I have configured node.js and npm to work behind the proxy and I do not have any problems downloading dependencies.
Now when I started a firebase project I did not have any problem logging into my Firebase account. However when I tried to:
firebase use --add
in my project folder I get the following error message:
Error: Server Error. unable to get local issuer certificate
From the firebase-debug.log I get more info:
[debug] [2017-10-16T14:43:42.993Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects Mon Oct 16 2017 16:43:42 GMT+0200 (ora legale Europa occidentale)
[debug] [2017-10-16T14:43:43.587Z] Error: unable to get local issuer certificate at Error (native) at TLSSocket.<anonymous>(_tls_wrap.js:1092:38) at emitNone (events.js:86:13) at TLSSocket.emit (events.js:185:7) at TLSSocket._finishInit (_tls_wrap.js:610:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:440:38)
[error]
[error] Error: Server Error. unable to get local issuer certificate
I tried to use
npm config set cafile "<path-to-a-cert-extracted-from-cacert.pem>"
with no luck.
I really can't figure out what's going on and I couldn't find any solution on the web.
On StackOverflow there's a similar question but the answers seem to point to a different problem.
I would be glad to hear if someone has found a solution to this problem. Thanks.
Ok so basically after 2 days of research I finally came up with a (hack)solution by looking at Node.js documentation on TLS.
Setting the following environment variable does the trick:
set NODE_TLS_REJECT_UNAUTHORIZED=0
I personally don't like this solution but at least it makes me work.
Is this something that has to be fixed?
Or am I missing something on the configuration of npm behind a proxy?
Thanks.

Resources