What is the freshest instruction on how to host a flutter web app?
I am following https://developer.school/tutorials/hosting-a-flutter-web-project-on-firebase-hosting on Windows, and the step firebase init here fails for me.
Here is the content of firebase-debug.log:
You're about to initialize a Firebase project in this directory:
C:\Coding Repository\230102 flutter hello world\flutter_hello_world
Before we get started, keep in mind:
* You are currently outside your home directory
[info]
=== Project Setup
[info]
[info] First, let's associate this project directory with a Firebase project.
[info] You can create multiple project aliases by running firebase use --add,
[info] but for now we'll just set up a default project.
[info]
[info] i If you want to create a project in a Google Cloud organization or folder, please use "firebase projects:create" instead, and return to this command when you've created the project.
[debug] [2023-01-03T04:11:48.673Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects [none]
[debug] [2023-01-03T04:11:48.674Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects {"projectId":"flutter_hello_world_deployment_by_mish","name":"flutter_hello_world"}
[debug] [2023-01-03T04:11:48.832Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects 400
[debug] [2023-01-03T04:11:48.832Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects {"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT","details":[{"#type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"project_id","description":"project_id must be at most 30 characters long"},{"field":"project_id","description":"project_id contains invalid characters"},{"field":"display_name","description":"project display name contains invalid characters"}]},{"#type":"type.googleapis.com/google.rpc.Help","links":[{"url":"https://cloud.google.com/resource-manager/reference/rest/v1/projects"}]}]}}
[debug] [2023-01-03T04:11:48.881Z] FirebaseError: HTTP Error: 400, Request contains an invalid argument.
at responseToError (C:\Users\mishc\AppData\Roaming\npm\node_modules\firebase-tools\lib\responseToError.js:49:12)
at RetryOperation._fn (C:\Users\mishc\AppData\Roaming\npm\node_modules\firebase-tools\lib\apiv2.js:288:77)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[error]
[error] Error: Failed to create project. See firebase-debug.log for more info.
The error message says:
project_id must be at most 30 characters long
So it sounds like you entered a project ID that was longer than that.
I am running a corda network on kubernetes (corda version 4.4) and I am trying to install and run a cordapp .
The cordapp am trying to run is the Heartbeat one (from the github corda sample folder) .
But whenever I try to start the flow using the command start StartHeartbeatFlow
I get the following error message :
[INFO] 11:00:32+0200 [pool-2-thread-11] shell.StartShellCommand.main - Executing command "start StartHeartbeatFlow <no arguments>",
start StartHeartbeatFlow: exception: com.heartbeat.StartHeartbeatFlow
Tue Apr 07 11:00:32 CEST 2020>>> [ERROR] 11:00:32+0200 [pool-2-thread-11] command.CRaSHSession.execute - Error while evaluating request 'start StartHeartbeatFlow' start StartHeartbeatFlow: exception: com.heartbeat.StartHeartbeatFlow [errorCode=1oe81or, moreInformationAt=https://errors.corda.net/OS/4.4/1oe81or]
Which doesn't really help me on how to solve the issue :/
Running flow list is listing the StartHeartbeatFlow so it's not an issue with the installation of the cordapp ...
Has anyone encountered the same kind of issue ?
Thanks !
Edit : The logs in the corda node I have when I execute the flow start StartHeartbeatFlow command .
corda#corda-node-corda-node-0:~/logs$ tail -f corda-node.log | grep -A 10 -B 10 "heartbeat"
[DEBUG] 2020-04-07T13:21:09,767Z [Thread-8 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5#2f4a89fa)] realm.AuthenticatingRealm. - Looked up AuthenticationInfo [rpcuser] from doGetAuthenticationInfo
[DEBUG] 2020-04-07T13:21:09,767Z [Thread-8 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5#2f4a89fa)] realm.AuthenticatingRealm. - AuthenticationInfo caching is disabled for info [rpcuser]. Submitted token: [org.apache.shiro.authc.UsernamePasswordToken - rpcuser, rememberMe=false].
[DEBUG] 2020-04-07T13:21:09,767Z [Thread-8 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5#2f4a89fa)] credential.SimpleCredentialsMatcher. - Performing credentials equality check for tokenCredentials of type [[C and accountCredentials of type [java.lang.String]
[DEBUG] 2020-04-07T13:21:09,767Z [Thread-8 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5#2f4a89fa)] credential.SimpleCredentialsMatcher. - Both credentials arguments can be easily converted to byte arrays. Performing array equals comparison
[DEBUG] 2020-04-07T13:21:09,767Z [Thread-8 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5#2f4a89fa)] authc.AbstractAuthenticator. - Authentication successful for token [org.apache.shiro.authc.UsernamePasswordToken - rpcuser, rememberMe=false]. Returned account [rpcuser]
[DEBUG] 2020-04-07T13:21:09,768Z [Thread-8 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5#2f4a89fa)] artemis.BrokerJaasLoginModule. - Login for rpcuser succeeded
[DEBUG] 2020-04-07T13:21:09,771Z [Thread-12 (ActiveMQ-client-global-threads)] rpc.RPCServer. - -> RPC by rpcuser -> registeredFlows
[DEBUG] 2020-04-07T13:21:09,772Z [Thread-12 (ActiveMQ-client-global-threads)] rpc.RPCServer. - Arguments: [] {actor_id=rpcuser, actor_owning_identity=OU=Regular Node, O=organization, L=Brussels, C=BE, actor_store_id=NODE_CONFIG, invocation_id=aac88106-cf60-4c63-b1b9-c5fac224b89a, invocation_timestamp=2020-04-07T13:21:09.771Z, origin=rpcuser, session_id=df6cc401-6f9f-41b5-9a18-790c28e33b06, session_timestamp=2020-04-07T13:11:30.204Z}
[DEBUG] 2020-04-07T13:21:09,772Z [rpc-server-handler-pool-1] realm.AuthorizingRealm. - No authorizationCache instance set. Checking for a cacheManager... {actor_id=rpcuser, actor_owning_identity=OU=Regular Node, O=organization, L=Brussels, C=BE, actor_store_id=NODE_CONFIG, invocation_id=aac88106-cf60-4c63-b1b9-c5fac224b89a, invocation_timestamp=2020-04-07T13:21:09.771Z, origin=rpcuser, session_id=df6cc401-6f9f-41b5-9a18-790c28e33b06, session_timestamp=2020-04-07T13:11:30.204Z}
[DEBUG] 2020-04-07T13:21:09,772Z [rpc-server-handler-pool-1] realm.AuthorizingRealm. - No cache or cacheManager properties have been set. Authorization cache cannot be obtained. {actor_id=rpcuser, actor_owning_identity=OU=Regular Node, O=organization, L=Brussels, C=BE, actor_store_id=NODE_CONFIG, invocation_id=aac88106-cf60-4c63-b1b9-c5fac224b89a, invocation_timestamp=2020-04-07T13:21:09.771Z, origin=rpcuser, session_id=df6cc401-6f9f-41b5-9a18-790c28e33b06, session_timestamp=2020-04-07T13:11:30.204Z}
[DEBUG] 2020-04-07T13:21:09,773Z [rpc-server-sender] rpc.RPCServer. - <- RPC <- RpcReply(id=10ea96d9-5c19-4200-a64e-1eb3903835ce, timestamp: 2020-04-07T13:21:09.748Z, entityType: Invocation, result=Success([com.heartbeat.StartHeartbeatFlow, net.corda.core.flows.ContractUpgradeFlow$Authorise, net.corda.core.flows.ContractUpgradeFlow$Deauthorise, net.corda.core.flows.ContractUpgradeFlow$Initiate]), deduplicationIdentity=9c974c01-08af-44d0-bdef-c609efee11a8)
[DEBUG] 2020-04-07T13:21:09,775Z [Thread-62 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5#2f4a89fa)] artemis.BrokerJaasLoginModule. - Processing login for SystemUsers/NodeRPC
[DEBUG] 2020-04-07T13:21:09,775Z [Thread-62 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5#2f4a89fa)] artemis.BrokerJaasLoginModule. - Login for SystemUsers/NodeRPC succeeded
[DEBUG] 2020-04-07T13:21:09,809Z [Network Map Updater Thread-1] pool.PoolBase. - HikariPool-1 - Reset (autoCommit) on connection org.postgresql.jdbc.PgConnection#6fa7296c
[DEBUG] 2020-04-07T13:21:10,560Z [RxIoScheduler-2] network.NodeInfoWatcher. - pollDirectory /opt/corda/additional-node-infos
[DEBUG] 2020-04-07T13:21:10,560Z [RxIoScheduler-2] network.NodeInfoWatcher. - Examining /opt/corda/additional-node-infos/nodeInfo-FEBE485DF04D12B91F70740AC3EDDDB1A0C5058B017C6DD6046A1AF37AB1687D
[DEBUG] 2020-04-07T13:21:10,560Z [RxIoScheduler-2] network.NodeInfoWatcher. - Read 0 NodeInfo files from /opt/corda/additional-node-infos
[DEBUG] 2020-04-07T13:21:10,560Z [RxIoScheduler-2] network.NodeInfoWatcher. - Number of removed NodeInfo files 0
[DEBUG] 2020-04-07T13:21:11,824Z [Network Map Updater Thread-1] pool.PoolBase. - HikariPool-1 - Reset (autoCommit) on connection org.postgresql.jdbc.PgConnection#6fa7296c
[DEBUG] 2020-04-07T13:21:13,844Z [Network Map Updater Thread-1] pool.PoolBase. - HikariPool-1 - Reset (autoCommit) on connection org.postgresql.jdbc.PgConnection#6fa7296c
[DEBUG] 2020-04-07T13:21:15,559Z [RxIoScheduler-2] network.NodeInfoWatcher. - pollDirectory /opt/corda/additional-node-infos
I could invoke the flow from the standalone shell , I was having some weird issues with the /cordapp folder holding my cordapp locally . I deleted it and recreated it and now it works .
Can you update your question with more stack trace? Are there any other errors in your node's log file? I'm asking because I just tried the example and it worked for me.
Here's what I did:
Built the Java version:
// Browse to Java files.
cd /heartbeat/contracts-java
// Build the nodes (Notary and PartyA).
./../gradlew deployNodes
Start the nodes (I don't like using runnodes task, so I start each node individually):
// Terminal 1 (Notary).
cd /heartbeat/contracts-java/build/nodes/Notary
// Start the Notary.
java -jar corda.jar
// Terminal 2 (PartyA).
cd /heartbeat/contracts-java/build/nodes/PartyA
// Start PartyA.
java -jar corda.jar
Start the flow inside of PartyA's terminal. Notice that I use flow start instead of just start (like in your case); it's worth trying flow start, even though both should work:
flow start StartHeartbeatFlow
You will see in my screenshot below that the flow completed (i.e. it created the SchedulableState that will start the flow again, which will lead to an endless loop until you shutdown the node):
Now I can watch that flow being called again and again by typing the below in PartyA's terminal:
flow watch
I could invoke the flow from the standalone shell , I was having some weird issues with the /cordapp folder holding my cordapp locally . I deleted it and recreated it and now it works .
I am trying to deploy my angular app to firebase, I have tried all methods to init firebase, select hosting and then deploying my app on firebase from various tutorials. But I always get an error:
I don't know what's wrong .
This is how my firebase-debug.log looks
[debug] [2020-03-26T10:42:00.096Z] ----------------------------------------------------------------------
[debug] [2020-03-26T10:42:00.098Z] Command: C:\Program Files\nodejs\node.exe C:\Users\pulki\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js deploy
[debug] [2020-03-26T10:42:00.098Z] CLI Version: 7.16.1
[debug] [2020-03-26T10:42:00.098Z] Platform: win32
[debug] [2020-03-26T10:42:00.098Z] Node Version: v10.16.3
[debug] [2020-03-26T10:42:00.099Z] Time: Thu Mar 26 2020 16:12:00 GMT+0530 (India Standard Time)
[debug] [2020-03-26T10:42:00.099Z] ----------------------------------------------------------------------
[debug] [2020-03-26T10:42:00.099Z]
[debug] [2020-03-26T10:42:00.105Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2020-03-26T10:42:00.105Z] > authorizing via signed-in user
[debug] [2020-03-26T10:42:00.105Z] [iam] checking project frezzo-pul5 for permissions ["firebase.projects.get","firebasedatabase.instances.update","firebasehosting.sites.update"]
[debug] [2020-03-26T10:42:00.108Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2020-03-26T10:42:00.108Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[debug] [2020-03-26T10:42:00.624Z] <<< HTTP RESPONSE 200
[debug] [2020-03-26T10:42:00.630Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/frezzo-pul5:testIamPermissions
[debug] [2020-03-26T10:42:02.770Z] <<< HTTP RESPONSE 200
[debug] [2020-03-26T10:42:02.772Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/frezzo-pul5
[debug] [2020-03-26T10:42:03.760Z] <<< HTTP RESPONSE 200
[info]
[info] === Deploying to 'frezzo-pul5'...
[info]
[info] i deploying database, hosting
[info] i database: checking rules syntax...
[debug] [2020-03-26T10:42:03.764Z] >>> HTTP REQUEST PUT https://frezzo-pul5.firebaseio.com/.settings/rules.json?dryRun=true
{
"rules": {
".read": true,
".write": true
}
}
[debug] [2020-03-26T10:42:06.330Z] <<< HTTP RESPONSE 404
[debug] [2020-03-26T10:42:06.330Z] <<< HTTP RESPONSE BODY {
"error" : "Firebase error. Please ensure that you spelled the name of your Firebase correctly"
}
[error]
[error] Error: Unexpected error while deploying database rules.
I have set no security on my firebase Database. Is that an issue ?
I have also tried firebase serve to locally check my app and that just works fine.
Thanks for you help !!
If you deactivated one or more of the functions since activation, when running
$ firebase init for the first time, it will mess up things when trying to deploy.
For example, sometimes realtime databases get automatically deactivated if you are not using them, just try to re-enable them to be able to deploy. Otherwise, you'll need to re-run the init with different options, and remove unused files for it to work.
Try initiating the firebase database from console. In most cases, the firebase database is not set on the cloud, so the console utility is not able to upload the db rules, and hence gives this error. Try using the following commands:
firebase init database
following updates will follow on the console:
=== Database Setup
i database: ensuring required API firebasedatabase.googleapis.com is enabled...
⚠ database: missing required API firebasedatabase.googleapis.com. Enabling now...
✔ database: required API firebasedatabase.googleapis.com is enabled
? It seems like you haven’t initialized Realtime Database in your project yet. Do you want to set it up? Yes
? Please choose the location for your default Realtime Database instance: us-central1
✔ Creating your default Realtime Database instance: ********-default-rtdb
With this, your database deployment error might get resolved.
I have several unit tests to test different Repositories of collections in Firestore.
If I run the entire unit tests, the first two of the Firestore unit tests run fine without timeout, but the subsequent ones get timeout all the time.
If I run the failing ones each on its own (i.e. using describe.only()) then it runs just fine without getting any timeout.
In the firestore-debug.log, I see the following entries:
----------------------------------------------------------------------
[debug] [2019-12-25T04:29:17.643Z] Command: /usr/local/bin/node /usr/local/bin/firebase emulators:exec mocha --recursive
[debug] [2019-12-25T04:29:17.643Z] CLI Version: 7.9.0
[debug] [2019-12-25T04:29:17.643Z] Platform: darwin
[debug] [2019-12-25T04:29:17.643Z] Node Version: v12.13.1
[debug] [2019-12-25T04:29:17.647Z]
----------------------------------------------------------------------
[debug] [2019-12-25T04:29:17.647Z]
[debug] [2019-12-25T04:29:17.658Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2019-12-25T04:29:17.658Z] > authorizing via signed-in user
[info] i emulators: Starting emulators: functions, firestore, hosting
[warn] ⚠ Your requested "node" version "8" doesn't match your global version "12"
[info] ✔ functions: Emulator started at http://localhost:5001
[info] i firestore: Serving ALL traffic (including WebChannel) on http://localhost:5002
[warn] ⚠ firestore: Support for WebChannel on a separate port (5003) is DEPRECATED and will go away soon. Please use port above instead.
[debug] [2019-12-25T04:29:17.994Z] Ignoring unsupported arg: projectId
[debug] [2019-12-25T04:29:17.994Z] Ignoring unsupported arg: auto_download
[debug] [2019-12-25T04:29:17.994Z] Starting emulator firestore with command {"binary":"java","args":["-Duser.language=en","-jar","/Users/yoda/.cache/firebase/emulators/cloud-firestore-emulator-v1.10.2.jar","--host","localhost","--port",5002,"--rules","/Users/yoda/Projects/p0rnhub/service/firestore.rules","--functions_emulator","localhost:5001","--webchannel_port",5003],"optionalArgs":["port","webchannel_port","host","rules","functions_emulator"],"joinArgs":false}
[info] i firestore: Emulator logging to firestore-debug.log
[debug] [2019-12-25T04:29:19.869Z] API endpoint: http://
[debug] [2019-12-25T04:29:19.869Z] localhost:5002
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
export FIRESTORE_EMULATOR_HOST=localhost:
[debug] [2019-12-25T04:29:19.869Z] 5002
Dev App Server is now running.
[info] ✔ firestore: Emulator started at http://localhost:5002
[info] i firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:5002
[debug] [2019-12-25T04:29:20.035Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2019-12-25T04:29:20.036Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[debug] [2019-12-25T04:29:20.185Z] <<< HTTP RESPONSE 200
[debug] [2019-12-25T04:29:20.200Z] >>> HTTP REQUEST GET https://firebase.googleapis.com/v1beta1/projects/p0rnhub/webApps/-/config
[debug] [2019-12-25T04:29:21.157Z] <<< HTTP RESPONSE 200
[info] i hosting: Serving hosting files from: public
[info] ✔ hosting: Local server: http://localhost:5000
[info] ✔ hosting: Emulator started at http://localhost:5000
[info] i functions: Watching "/Users/yoda/Projects/p0rnhub/service/functions" for Cloud Functions...
[debug] [2019-12-25T04:29:21.435Z] [worker-~diagnostic~-8c5a2752-d4c3-408b-b55c-df1aba3f5987]: Assigning socketPath: /var/folders/h5/x3f6g38d1n5_wd1mrk8_ckm00000gn/T/fire_emu_67092.sock
[debug] [2019-12-25T04:29:21.435Z] [worker-~diagnostic~-8c5a2752-d4c3-408b-b55c-df1aba3f5987]: BUSY
[debug] [2019-12-25T04:29:21.804Z] [runtime-status] [67092] Functions runtime initialized. {"cwd":"/Users/yoda/Projects/p0rnhub/service/functions","node_version":"12.13.1"}
[debug] [2019-12-25T04:29:21.806Z] [runtime-status] [67092] Disabled runtime features: undefined
[debug] [2019-12-25T04:29:21.810Z] [runtime-status] [67092] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.8.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-admin/lib/index.js"}
[debug] [2019-12-25T04:29:21.812Z] [runtime-status] [67092] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.3.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-functions/lib/index.js"}
[debug] [2019-12-25T04:29:22.124Z] [runtime-status] [67092] Found google-gax at /Users/yoda/Projects/p0rnhub/service/functions/node_modules/google-gax/build/src/index.js
[debug] [2019-12-25T04:29:22.124Z] [runtime-status] [67092] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"},{"name":"google-gax","status":"mocked"}]
[debug] [2019-12-25T04:29:22.178Z] [runtime-status] [67092] Checked functions.config() {"config":{}}
[debug] [2019-12-25T04:29:22.179Z] [runtime-status] [67092] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.3.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-functions/lib/index.js"}
[debug] [2019-12-25T04:29:22.180Z] [runtime-status] [67092] Resolved module firebase-admin {"declared":true,"installed":true,"version":"8.8.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-admin/lib/index.js"}
[debug] [2019-12-25T04:29:22.180Z] [runtime-status] [67092] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.3.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-functions/lib/index.js"}
[debug] [2019-12-25T04:29:22.232Z] [runtime-status] [67092] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"8.8.0","resolution":"/Users/yoda/Projects/p0rnhub/service/functions/node_modules/firebase-admin/lib/index.js"}}
[info] ✔ functions[auth]: http function initialized (http://localhost:5001/p0rnhub/us-central1/auth).
[info] ✔ functions[token]: http function initialized (http://localhost:5001/p0rnhub/us-central1/token).
[info] ✔ functions[login]: http function initialized (http://localhost:5001/p0rnhub/us-central1/login).
[info] ✔ functions[start]: http function initialized (http://localhost:5001/p0rnhub/us-central1/start).
[info] ✔ functions[stop]: http function initialized (http://localhost:5001/p0rnhub/us-central1/stop).
[info] ✔ functions[list]: http function initialized (http://localhost:5001/p0rnhub/us-central1/list).
[info] i Running script: mocha --recursive
[debug] [2019-12-25T04:29:22.252Z] Running mocha --recursive with environment {"npm_config_save_dev":"","npm_config_legacy_bundling":"","npm_config_dry_run":"","npm_config_viewer":"man","npm_config_only":"","npm_config_commit_hooks":"true","npm_config_browser":"","npm_config_also":"","npm_config_sign_git_commit":"","npm_config_rollback":"true","TERM_PROGRAM":"Apple_Terminal","NODE":"/usr/local/bin/node","npm_config_usage":"","npm_config_audit":"true","INIT_CWD":"/Users/yoda/Projects/p0rnhub/service/functions","npm_package_devDependencies_sinon":"^7.5.0","npm_config_globalignorefile":"/usr/local/etc/npmignore","npm_package_devDependencies_mocha":"^6.2.2","TERM":"xterm-256color","SHELL":"/bin/zsh","npm_config_shell":"/bin/zsh","npm_config_maxsockets":"50","npm_config_init_author_url":"","npm_config_shrinkwrap":"true","npm_config_parseable":"","npm_config_metrics_registry":"https://registry.npmjs.org/","TMPDIR":"/var/folders/h5/x3f6g38d1n5_wd1mrk8_ckm00000gn/T/","npm_config_timing":"","npm_config_init_license":"ISC","npm_config_if_present":"","TERM_PROGRAM_VERSION":"433","npm_config_sign_git_tag":"","npm_config_init_author_email":"","npm_config_cache_max":"Infinity","npm_package_dependencies_uuid":"^3.3.3","npm_config_preid":"","npm_config_long":"","npm_config_local_address":"","npm_config_git_tag_version":"true","npm_config_cert":"","TERM_SESSION_ID":"AD305AB7-88B6-4E8E-9681-273EEB25429A","npm_config_registry":"https://registry.npmjs.org/","npm_config_noproxy":"","npm_config_fetch_retries":"2","npm_package_private":"true","npm_config_versions":"","npm_config_message":"%s","npm_config_key":"","npm_package_description":"Cloud Functions for Firebase","USER":"yoda","npm_package_scripts_deploy":"firebase deploy --only functions","npm_config_globalconfig":"/usr/local/etc/npmrc","npm_package_scripts_shell":"firebase functions:shell","npm_config_prefer_online":"","npm_config_logs_max":"10","npm_config_always_auth":"","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.sLVgtsWI6z/Listeners","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0","npm_execpath":"/usr/local/lib/node_modules/npm/bin/npm-cli.js","npm_config_global_style":"","npm_config_cache_lock_retries":"10","npm_package_dependencies_firebase_functions":"^3.3.0","npm_config_update_notifier":"true","npm_config_cafile":"","npm_config_heading":"npm","npm_config_audit_level":"low","npm_config_searchlimit":"20","npm_config_read_only":"","npm_config_offline":"","npm_config_fetch_retry_mintimeout":"10000","npm_config_json":"","npm_config_access":"","npm_config_argv":"{\"remain\":[],\"cooked\":[\"test\"],\"original\":[\"test\"]}","PATH":"/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/yoda/Projects/p0rnhub/service/functions/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin","npm_config_allow_same_version":"","npm_config_https_proxy":"","npm_config_engine_strict":"","npm_config_description":"true","_":"/usr/local/bin/firebase","LaunchInstanceID":"486CA774-9DDE-42B4-A90D-EB3553FE7181","npm_config_userconfig":"/Users/yoda/.npmrc","npm_config_init_module":"/Users/yoda/.npm-init.js","npm_config_cidr":"","PWD":"/Users/yoda/Projects/p0rnhub/service/functions","npm_config_user":"","npm_config_node_version":"12.13.1","npm_lifecycle_event":"test","npm_config_save":"true","npm_config_ignore_prepublish":"","npm_config_editor":"vi","npm_config_auth_type":"legacy","npm_package_name":"functions","npm_config_tag":"latest","npm_config_script_shell":"","npm_config_progress":"true","npm_config_global":"","npm_config_before":"","npm_package_scripts_start":"npm run shell","npm_config_searchstaleness":"900","npm_config_optional":"true","npm_config_ham_it_up":"","XPC_FLAGS":"0x0","npm_config_save_prod":"","npm_config_force":"","npm_config_bin_links":"true","npm_config_searchopts":"","npm_package_engines_node":"8","npm_config_node_gyp":"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js","npm_config_depth":"Infinity","npm_config_sso_poll_frequency":"500","npm_config_rebuild_bundle":"true","npm_package_version":"","XPC_SERVICE_NAME":"0","npm_config_unicode":"true","HOME":"/Users/yoda","SHLVL":"2","npm_config_fetch_retry_maxtimeout":"60000","npm_package_scripts_test":"firebase emulators:exec \"mocha --recursive\"","npm_config_tag_version_prefix":"v","npm_config_strict_ssl":"true","npm_config_sso_type":"oauth","npm_config_scripts_prepend_node_path":"warn-only","npm_config_save_prefix":"^","npm_config_loglevel":"notice","npm_config_ca":"","npm_package_scripts_serve":"firebase serve --only functions","npm_config_save_exact":"","npm_config_group":"20","npm_config_fetch_retry_factor":"10","npm_config_dev":"","npm_package_devDependencies_firebase_functions_test":"^0.1.7","npm_config_version":"","npm_config_prefer_offline":"","npm_config_cache_lock_stale":"60000","npm_package_devDependencies__firebase_testing":"^0.12.3","npm_config_otp":"","npm_config_cache_min":"10","npm_config_searchexclude":"","npm_config_cache":"/Users/yoda/.npm","npm_package_dependencies_base64url":"^3.0.1","npm_package_scripts_logs":"firebase functions:log","LOGNAME":"yoda","npm_lifecycle_script":"firebase emulators:exec \"mocha --recursive\"","npm_config_color":"true","npm_config_proxy":"","npm_config_package_lock":"true","npm_package_dependencies_build_url":"^1.3.3","LC_CTYPE":"UTF-8","npm_config_package_lock_only":"","npm_config_fund":"true","npm_config_save_optional":"","npm_config_ignore_scripts":"","npm_config_user_agent":"npm/6.13.4 node/v12.13.1 darwin x64","npm_config_cache_lock_wait":"10000","npm_config_production":"","npm_config_send_metrics":"","npm_config_save_bundle":"","npm_config_umask":"0022","npm_config_node_options":"","npm_config_init_version":"1.0.0","npm_config_init_author_name":"","npm_config_git":"git","npm_config_scope":"","SECURITYSESSIONID":"186a8","npm_config_unsafe_perm":"true","npm_config_tmp":"/var/folders/h5/x3f6g38d1n5_wd1mrk8_ckm00000gn/T","npm_config_onload_script":"","npm_package_dependencies_firebase_admin":"^8.8.0","npm_node_execpath":"/usr/local/bin/node","npm_config_prefix":"/usr/local","npm_config_link":"","npm_config_format_package_lock":"true","FIRESTORE_EMULATOR_HOST":"localhost:5002","FIREBASE_FIRESTORE_EMULATOR_ADDRESS":"localhost:5002"}
[debug] [2019-12-25T04:29:22.263Z] [worker-~diagnostic~-8c5a2752-d4c3-408b-b55c-df1aba3f5987]: exited
[debug] [2019-12-25T04:29:22.263Z] [worker-~diagnostic~-8c5a2752-d4c3-408b-b55c-df1aba3f5987]: FINISHED
[debug] [2019-12-25T04:29:23.385Z] Dec 25, 2019 11:29:23 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
[debug] [2019-12-25T04:29:24.429Z] Dec 25, 2019 11:29:24 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
[warn] ⚠ Script exited unsuccessfully (code 4)
[info] i Shutting down emulators.
[info] i Stopping functions emulator
[info] i Stopping firestore emulator
[debug] [2019-12-25T04:29:34.479Z] *** shutting down gRPC server since JVM is shutting down
[debug] [2019-12-25T04:29:34.482Z] *** server shut down
[info] i Stopping hosting emulator
[error]
[error] Error: Script "mocha --recursive" exited with code 4
Here's how I setup each Firestore unit test:
const assert = require("assert")
const firebase = require("#firebase/testing")
const { SampleRepository } = require("./SampleRepository")
const projectId = "a-project-id"
const app = firebase.initializeAdminApp({ projectId })
describe("SampleRepository", () => {
var db
var repository
before(async () => {
db = app.firestore()
repository = new SampleRepository(db)
})
afterEach(async () => {
await firebase.clearFirestoreData({ projectId })
})
after(async () => {
await db.terminate()
})
describe("firstMethod", () => {
it("use case 1", async () => {
// Do some testing here.
})
it("use case 2", async () => {
// Do some testing here.
})
})
describe("secondMethod", () => {
it("use case 1", async () => {
// Do some testing here.
})
})
})
I setup the npm test command to invoke this: firebase emulators:exec \"mocha --recursive\".
At this point, I am pretty clueless what causes this but I suspect it's a problem in the Firestore emulator or something? And I don't know what code 4 means in: Script exited unsuccessfully (code 4).
Any help is appreciated.
UPDATE 1: Now I know what the code 4 means. It means that I have 4 failing tests.