I am using multiple updates feature on Firebase where I have created a object which is updating multiple locations in the database at once. I have given write permissions to each of those locations individually. Here is an example of what I am trying to update on Firebase as part of multiple updates
{
"alarms/298302f2-f95d-4200-b2ca-53dcf5706125/date": 1478141940167,
"userInfos/-KGvMbo5MK-W5q4qgcF0/alarms/298302f2-f95d-4200-b2ca-53dcf5706125": 1478141940167,
"userInfos/-KGvMIPwul2dUY181xLQ/backupForAlarms/298302f2-f95d-4200-b2ca-53dcf5706125": 1478141940167,
"alarms/57656d1f-4c01-4807-93ea-44ab42791140/date": 1479979440107,
"userInfos/-KGvMbo5MK-W5q4qgcF0/alarms/57656d1f-4c01-4807-93ea-44ab42791140": 1479979440107
}
Let's say firebaseUpdateObj contains the above object. I am using below line of code to perform the update
firebase.database().ref().update(firebaseUpdateObj)
I am seeing the following error on the console
FIREBASE WARNING: update at / failed: permission_denied
I have given write permissions to the alarms and the userInfos branch in the rules file and I am able to write at both of these locations using firebase.database().ref().child('alarms').child(alarmId).set(alarm) and firebase.database().ref().child('userInfos').child(uid).set(userInfo). But looks like when I am giving the update command like above, it's trying to check if I have write permission at location / which I obviously don't.
Is this expected behavior? I am able to run similar update command on the server side but there I have the server permissions, so I guess the rules don't come into picture there. I am using Firebase 3.3.0.
Related
I'm building a Jira App with Forge where I retrieve board data from the Jira Cloud Rest API. Data retrieval is done in a client-side script using requestJira from #forge/bridge. I'm able to successfully retrieve a list of all boards using the route /rest/agile/1.0/board but when I try to retrieve the configuration of a selected board using the route '/rest/agile/1.0/board/' + boardId + '/configuration' e.g. /rest/agile/1.0/board/4/configuration, this leads to the error response 403 "Forbidden".
In manifest.yml I have defined permissions as follows:
permissions:
scopes:
- read:jira-work
One should think that this should be enough for retrieving board configurations, particularly since the retrieval of the board list was successful. If not, then what is the required permission in this case? Or what else might be going wrong here?
I also tried executing api.asApp().requestJira('/rest/agile/1.0/board/4/configuration',{}) from #forge/api on the server side. Result was the same, i.e. also a 403 response.
The route /rest/agile/1.0/board/4/configuration works fine when pasted into a browser's address field after the URL of my dev instance.
I am having an angular app which connects to 2 firebase projects:
The default project is connected on app load via AngularFireModule.initializeApp(environment.firebaseConfig) (AngularFire2)
The secondary project is connected at run time via firebase.initializeApp(firebaseConfig, 'pr1'); (Firebase JS SDK)
Now the firebase config of the 2nd project is received from user through UI. So I need to validate if the firebase project exists with given credentials, before I could do any operation.
Calling res = firebase.initializeApp(firebaseConfig, 'pr1'); with invalid apiKey, authDomain, projectId, storageBucket, etc., is not throwing any error, but successfully returning a FirebaseAppImpl object.
After initialization, calling
res.auth()
res.storage()
also doesnt throw any errors but returning me proper objects.
Only for res.database(), I am getting a console warning as follows:
#firebase/database: FIREBASE WARNING: Firebase error. Please ensure that you spelled the name of your Firebase correctly (https://[invalid-url].firebaseio.com)
But its not throwing any errors, that I could act on.
I need to validate the given keys, and alert the user that 1 or more key is wrong. Any suggestions on how to do this?
Update 1:
Had a look at Firebase Management API: https://firebase.google.com/docs/projects/api/reference/rest
It has many functions like creating, retrieving projects.
But I am not sure, how to make use of any of these APIs to my requirement.
Have been looking for a way to programmatically update our agent's entity entries for a certain entity type through the DialogFlow API. The purpose is to automate the updating of our entity entries on a scheduled basis (as our entries will be changing daily).
Came across this documentation page by Google on batch updating entity entries but have not been able to get anything better than a 404 when testing.
Have tried sending POST's via Postman using the supplied path and inserting my project name in URL but I believe I may be making naive mistakes as I am new to this area (specifically REST-stuff)
Below is an example of the current 404 response & path used.
We are just looking to get past the 404 error, once we have the contact setup, should be able to figure out auth & the rest.
There are several things you need to take into account.
The URL should look like this:
https://dialogflow.googleapis.com/v2/projects/julia-development-2/agent/entityTypes/actual_id/entities:batchUpdate
the "parent" you used in the URL is just the name of the path param
make sure "julia-development-2" is the id of your GCP project and not just the name
(Hint: when you click the drop-down for selecting a certain GCP project in the google cloud console, both the name and the ID of the project will be visibile in the list)
replace "actual_id" with the entity type id
Related to auth:
you need a bearer token in the Authorization header
to get this token you first need to download a JSON key from your projects service account and set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to your JSON file. More details about setting up the service account and downloading the JSON key, you can find here: https://cloud.google.com/dialogflow/docs/setup
to get the token from the command line you can use
gcloud auth application-default print-access-token
As you can see, i am working on smart contracts.
I have a parsing function that when i give an ABI/JSON it is showing up the function with is variable.
Now, i want the informations that getting out from the parsing to sending them to the MetaMask, but i don't know how is proper to get them and i need help with the source code.
I want to have in one variable the function type as it is shown at the picture with the arrow.
And i want making variables name with the names that are shown (_startTime as an example) with the value from the input box that the user will give.
Metamask is a plugin used to execute the transaction. You can also send data with the transaction to the Metamask. To initiate the transaction first you have to login into the Metamask. Later you have to select the Network in the metamask and use Web3 wrapper to execute the transaction. I did that using Truffle and running local blockchain on my PC.
Every time I try to deploy truffle migrate --reset my Organization.sol contract, I get the following error:
Error encountered, bailing. Network state unknown. Review successful transactions manually.
I Googled the error and apparently this is due to contract size. My Organization.sol is not even that big; I’ve seen bigger contracts before.
Here is my contract: https://github.com/ulixir/eth-task-contracts/blob/master/contracts/Organization.sol
Any clues?
Do you also see an error this error
Error: insufficient funds for gas * price + value
In that case, the ethereum account you are trying to use may not have enough ether to perform the migration.
Ether can be added to an account by calling miner.start() from the geth console or by allocating ether to the account using the genesis.json file. You can read more about it here.
If you decide to use the genesis file, take the following steps after allocating data to your ethereum account:
remove the old geth db using geth --datadir "<your datadir>" removedb.
Reinitialize your geth node using the modified genesis file geth <your other params here> init <yourGenesisFile>
within the geth console of the new node, make sure you start the miner miner.start()
When done, try the migration again, it should work now.
If you decided to mine ether without modifying the genesis file, start the mining and give your ethereum account some time to mine enough ether. How long this takes depends on the difficulty level you set on your genesis file.
When you are using this command truffle migrate --reset it is trying to deploy Migration.sol contract also with your Organization.sol .You can see the migration script in migration folder. The error
Error encountered, bailing. Network state unknown. Review successful transactions manually.
means that it cannot determine which contracts are deployed.And telling you to check manually.To check which contracts are deployed you can use this command truffle network.