Firebase Error: Unexpected error while deploying database rules - firebase

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.

Related

How to host flutter application in Firebase?

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.

Not able to use realtime local emulator database

I followed some tutorials to use local emulators on my laptop.
the installation went well and I could start the emulator.
I see the realtime Database in green and can see the empty DB.
But from there, I am not able to do anything at all:
Import a DB: I get the following error: "NetworkError when attempting to fetch resource."
Adding some fields/Values in the Database from the GUI:
- I don't have any "+" sign to add values.
- I cannot save the values I put.
- I can see "Edit" or "Delete" button, but they have no effect...
There is something going wrong somewhere and that may be due to some config, but I don't know what that should be.
I don't find documentation relatively and did not find any "Google" article relatively.
Any support would be very welcome as I am currently blocked with my project.
Thank you.
LOGS:
database-debug.log
*Picked up JAVA_TOOL_OPTIONS: -Xmx4g
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/root/.cache/firebase/emulators/firebase-database-emulator-v4.9.0.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
17:34:03.761 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
17:34:03.894 [main] INFO com.firebase.server.forge.App$ - Listening at 127.0.0.1:9000*
firebase-debug.log
*_[debug] [2022-10-01T00:34:02.410Z] ----------------------------------------------------------------------
[debug] [2022-10-01T00:34:02.412Z] Command: /usr/local/bin/firebase /root/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/bin/firebase emulators:start
[debug] [2022-10-01T00:34:02.412Z] CLI Version: 11.12.0
[debug] [2022-10-01T00:34:02.412Z] Platform: linux
[debug] [2022-10-01T00:34:02.412Z] Node Version: v16.16.0
[debug] [2022-10-01T00:34:02.412Z] Time: Fri Sep 30 2022 17:34:02 GMT-0700 (Pacific Daylight Time)
[debug] [2022-10-01T00:34:02.413Z] ----------------------------------------------------------------------
[debug]
[debug] [2022-10-01T00:34:02.471Z] > 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] [2022-10-01T00:34:02.472Z] > authorizing via signed-in user (ebonnefoy#rbbn.com)
[debug] [2022-10-01T00:34:02.481Z] Picked up JAVA_TOOL_OPTIONS: -Xmx4g
[debug] [2022-10-01T00:34:02.513Z] openjdk version "11.0.16" 2022-07-19
[debug] [2022-10-01T00:34:02.514Z] OpenJDK Runtime Environment (build 11.0.16+8-post-Debian-1)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Debian-1, mixed mode, sharing)
[debug] [2022-10-01T00:34:02.523Z] Parsed Java major version: 11
[info] i emulators: Starting emulators: auth, database {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: auth, database"}}
[debug] [2022-10-01T00:34:02.536Z] [hub] writing locator at /tmp/hub-testemul01.json
[debug] [2022-10-01T00:34:02.543Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/testemul01 [none]
[debug] [2022-10-01T00:34:02.747Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/testemul01 200
[debug] [2022-10-01T00:34:02.748Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/testemul01 {"projectId":"testemul01","projectNumber":"820099885379","displayName":"testemul1","name":"projects/testemul01","resources":{"hostingSite":"testemul01"},"state":"ACTIVE","etag":"1_e1300143-b10e-4def-88a1-a6736b7b5a04"}
[debug] [2022-10-01T00:34:02.749Z] database rules config: []
[warn] ⚠ database: Did not find a Realtime Database rules file specified in a firebase.json config file. The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration. {"metadata":{"emulator":{"name":"database"},"message":"Did not find a Realtime Database rules file specified in a firebase.json config file. The emulator will default to allowing all reads and writes. Learn more about this option: https://firebase.google.com/docs/emulator-suite/install_and_configure#security_rules_configuration."}}
[debug] [2022-10-01T00:34:02.758Z] Ignoring unsupported arg: projectId {"metadata":{"emulator":{"name":"database"},"message":"Ignoring unsupported arg: projectId"}}
[debug] [2022-10-01T00:34:02.758Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"database"},"message":"Ignoring unsupported arg: auto_download"}}
[debug] [2022-10-01T00:34:02.758Z] Ignoring unsupported arg: rules {"metadata":{"emulator":{"name":"database"},"message":"Ignoring unsupported arg: rules"}}
[debug] [2022-10-01T00:34:02.758Z] Starting Database Emulator with command {"binary":"java","args":["-Duser.language=en","-jar","/root/.cache/firebase/emulators/firebase-database-emulator-v4.9.0.jar","--host","127.0.0.1","--port",9000],"optionalArgs":["port","host","functions_emulator_port","functions_emulator_host"],"joinArgs":false} {"metadata":{"emulator":{"name":"database"},"message":"Starting Database Emulator with command {"binary":"java","args":["-Duser.language=en","-jar","/root/.cache/firebase/emulators/firebase-database-emulator-v4.9.0.jar","--host","127.0.0.1","--port",9000],"optionalArgs":["port","host","functions_emulator_port","functions_emulator_host"],"joinArgs":false}"}}
[info] i database: Database Emulator logging to database-debug.log {"metadata":{"emulator":{"name":"database"},"message":"Database Emulator logging to \u001b[1mdatabase-debug.log\u001b[22m"}}
[debug] [2022-10-01T00:34:02.771Z] Picked up JAVA_TOOL_OPTIONS: -Xmx4g
{"metadata":{"emulator":{"name":"database"},"message":"Picked up JAVA_TOOL_OPTIONS: -Xmx4g\n"}}
[debug] [2022-10-01T00:34:03.258Z] WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/root/.cache/firebase/emulators/firebase-database-emulator-v4.9.0.jar) to field sun.nio.ch.SelectorImpl.selectedKeys
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
{"metadata":{"emulator":{"name":"database"},"message":"WARNING: An illegal reflective access operation has occurred\nWARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/root/.cache/firebase/emulators/firebase-database-emulator-v4.9.0.jar) to field sun.nio.ch.SelectorImpl.selectedKeys\nWARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil\nWARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations\nWARNING: All illegal access operations will be denied in a future release\n"}}
[debug] [2022-10-01T00:34:03.763Z] 17:34:03.761 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
{"metadata":{"emulator":{"name":"database"},"message":"17:34:03.761 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started\n"}}
[debug] [2022-10-01T00:34:03.895Z] 17:34:03.894 [main] INFO com.firebase.server.forge.App$ - Listening at 127.0.0.1:9000
{"metadata":{"emulator":{"name":"database"},"message":"17:34:03.894 [main] INFO com.firebase.server.forge.App$ - Listening at 127.0.0.1:9000\n"}}
[debug] [2022-10-01T00:34:09.740Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[debug] [2022-10-01T00:34:09.740Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
[debug] [2022-10-01T00:34:09.741Z] Starting Emulator UI with command {"binary":"node","args":["/root/.cache/firebase/emulators/ui-v1.9.0/server/server.js"],"optionalArgs":[],"joinArgs":false} {"metadata":{"emulator":{"name":"ui"},"message":"Starting Emulator UI with command {"binary":"node","args":["/root/.cache/firebase/emulators/ui-v1.9.0/server/server.js"],"optionalArgs":[],"joinArgs":false}"}}
[info] i ui: Emulator UI logging to ui-debug.log {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI logging to \u001b[1mui-debug.log\u001b[22m"}}
[debug] [2022-10-01T00:34:09.903Z] Web / API server started at 127.0.0.1:4000
{"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at 127.0.0.1:4000\n"}}
[info]
┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://127.0.0.1:4000 │
└─────────────────────────────────────────────────────────────┘
┌────────────────┬────────────────┬────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├────────────────┼────────────────┼────────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4000/auth │
├────────────────┼────────────────┼────────────────────────────────┤
│ Database │ 127.0.0.1:9000 │ http://127.0.0.1:4000/database │
└────────────────┴────────────────┴────────────────────────────────┘
Emulator Hub running at localhost:4400
Other reserved ports: 4500*

Cannot run flow in corda node

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 .

Unit test timeout when testing Firestore

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.

Issue in receiving Push Notifications in iOS

I face some issues in receiving push notification from 2 different servers. The servers' backend code is written in Java and I have used javapns library for apple push notifications. When I receive notification (from one of the servers), I get the following log statements,
2015-11-06/12:17:15.829 [DEBUG] [] [javapns.notification.Payload] - Adding alert [Alert Message]
2015-11-06/12:17:16.054 [DEBUG] [] [javapns.communication.ConnectionToAppleServer] - Creating SSLSocketFactory
2015-11-06/12:17:16.127 [DEBUG] [] [javapns.communication.ConnectionToAppleServer] - Creating SSLSocket to gateway.sandbox.push.apple.com:2195
2015-11-06/12:17:16.776 [DEBUG] [] [javapns.notification.PushNotificationManager] - Initialized Connection to Host: [gateway.sandbox.push.apple.com] Port: [2195]: 6644621c[SSL_NULL_WITH_NULL_NULL: Socket[addr=gateway.sandbox.push.apple.com/17.172.232.45,port=2195,localport=57181]]
2015-11-06/12:17:16.778 [DEBUG] [] [javapns.notification.PushNotificationManager] - Building Raw message from deviceToken and payload
2015-11-06/12:17:16.779 [DEBUG] [] [javapns.notification.PushNotificationManager] - Built raw message ID 1 of total length 91
2015-11-06/12:17:16.779 [DEBUG] [] [javapns.notification.PushNotificationManager] - Attempting to send notification: {"aps":{"alert":"Alert Message"}}
2015-11-06/12:17:16.779 [DEBUG] [] [javapns.notification.PushNotificationManager] - to device: e61aa2adfa16449f894b317ea3b4dbbfe4589000abdec7c8c0eb3c7b92654e4c
2015-11-06/12:17:17.696 [DEBUG] [] [javapns.notification.PushNotificationManager] - Flushing
2015-11-06/12:17:17.696 [DEBUG] [] [javapns.notification.PushNotificationManager] - At this point, the entire 91-bytes message has been streamed out successfully through the SSL connection
2015-11-06/12:17:17.696 [DEBUG] [] [javapns.notification.PushNotificationManager] - Notification sent on first attempt
2015-11-06/12:17:17.696 [DEBUG] [] [javapns.notification.PushNotificationManager] - Reading responses
2015-11-06/12:17:22.698 [DEBUG] [] [javapns.notification.PushNotificationManager] - Closing connection
But, when I do not receive the notification (from the other server), I get the following log,
2015-11-20/13:37:50.539 [DEBUG] [] [javapns.notification.Payload] - Adding alert [Alert Message]
2015-11-20/13:37:50.543 [DEBUG] [] [javapns.notification.PushNotificationManager] - Reading responses
2015-11-20/13:37:50.545 [DEBUG] [] [javapns.notification.PushNotificationManager] - Closing connection
Here, I am not getting any log statements regarding the creation of SSL Socket Factory or other highlighted texts. And the ConnectionToAppleServer class is not getting called. So, I doubt whether I am missing any jar files.
NOTE: I am using same development certificate in both the servers.
Any help will be appreciated.
The problem was not with the developer certificates or any jar files related to iOS. The server code was written to send notifications to both android and iOS. And some jar files related with android were missing. So, in the back end, the control dint reach the part where the code to send iOS notifications was written. That was the problem. Once, those jar files are added, everything works fine!!

Resources