I’m trying to get setup using Firebase Admin on my nodejs app running on my Raspberry Pi.
when I call;
admin.database().ref().child("myPath").push({date: new Date()});
I’m not receiving any errors but no data is showing up when looking in the Firebase console at my database either.
I also tried chaining on;
set({date: new Date()});
and
push().set({date: new Date()});
Both also fail to write with no errors.
I've verified that my rtdb url and the project id in the service account file are correct for my database. And I've tried both requireing the file as in the docs and passing the credential object directly to;
admin.credential.cert()
I only mention that I'm running on Raspberry Pi because the issue I’m seeing sounds very similar to this Stack Overflow post where Firebase Admin won’t write to db. I’m wondering if it’s not coincidental.
Any ideas what I might be missing?
please can you try this code .....push().set({'date': new Date()});. Thanks. I am guessing it's takes a String as key and even the new Date().toStirng() would be good if i am not wrong.
Thanks,
Related
My realtime database URL is like https://myprojectid.firebaseio.com
When I start my node.js server I have error message :
#firebase/database: FIREBASE WARNING: Firebase error. Please ensure
that you have the URL of your Firebase Realtime Database instance
configured correctly.
(https://myprojectid-default-rtdb.firebaseio.com/)
My Firebase config is :
# Firebase
apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx
authDomain=myprojectid.firebaseapp.com
databaseURL=https://myprojectid.firebaseio.com
projectId=myprojectid
storageBucket=myprojectid.appspot.com
messagingSenderId=00000000000000
appId=1:0000000000000:web:000000000000000
When I'm trying to debug npm library, I can see that namespace is indeed "myprojectid-default-rtdb" but can't find where to change it.
I tried to set databaseURL with query string ?ns=myprojectid but not better.
By searching on Google I could read :
For recently created Firebase projects the default database URI
usually has the format https://
-default-rtdb.firebaseio.com. Databases in projects
created before September 2020 had the default database URI
https://.firebaseio.com. For backward compatibility
reasons, if you don’t specify a database URI, the SDK will use the
project ID defined in the Service Account JSON file to automatically
generate it
Could you help me to find a solution please?
There's no way to change the name of the default database instance that is created in your Firebase project. If your project is on the paid plan, you can add additional database instances where you fully control the name, but not for the default one.
You will have to update your project configuration to use the correct database URL. If the database in the US data center, that'd be:
databaseURL=https://myprojectid-default-rtdb.firebaseio.com
I need some help. I created a CRUD with Flask, and I want to conect it with my MySQL in azure. I new using Flask, so I don't know how to do it. Somebody can help me?
Now, I tried to do this:
app.config['SQLALCHEMY_DATABASE_URI']'mysql://Myuser#Myuser:MyPasswrd#MyDataBase:3306/mySchema'
My localhost works, so, I tried to change the username,passwrd and database and thought that it would work. But it didn't. I can access my Mysql-azure via workbench btw.
Thank you for reading!
I tried it here, and I got an error, I'll put a photo here. idk if this errors is because I dont have a MySQL connection, or something (I was using but I removed to see if it would work). Here a print of my instance.py and the error Instance of server
It should work after installing mysql-connector.
pip install mysql-connector
change the SQLALCHEMY_DATABASE_URI in your python script to below and create your database.
app.config["SQLALCHEMY_DATABASE_URI"] = "mysql+mysqlconnector://{username}:{password}#{server}/testdb".format(username, password, server)
let me know if you see any specific error
So I am trying to create a new wallet using the Python wrapper for the coinbase api.
My current code is this:
from coinbase.wallet.client import Client
client = Client('API-Key',
'SECRET',
api_version='2019-12-30')
# Get your primary coinbase account
primary_account = client.get_primary_account()
address = primary_account.create_address()
print(address)
When trying to use the code above, I always get the error:
coinbase.wallet.error.AuthenticationError: APIError(id=authentication_error): request timestamp expired
My guess is that the wrapper is not passing the right timestamp.
On the github page for this wrapper, it says that the current build is failing. I don't know how to fix this. The github hasn't had any recent updates. I tried to look at the client file to see if I could fix it myself, but I have had no luck.
I was facing the same issue but, as I've understood from the various contributions, the problem is due to the difference between the local OS time and Coinbase servers time. Besides 30 seconds of epochs difference, coinbase server returns the tedious timestamp expiration error!
I've found python code to update local Windows time based on various ntp servers ntp_update_time.py (shared by gilmotta). Launching the ntp_update_time's code before running coinbase client again makes the error disappear and everything work as indicated in Coinbase API references!!!
In order to setup Google Identity Toolkit for my Website I started with the Quick-start App for Node.js.
It worked fine on localhost.
But when I moved it to an actual app-engine instance it did not work anymore.
I got this error returned by gitkitClient.verifyGitkitToken():
Invalid token: Unable to verify the ID Token: Wrong recipient, payload
audience != requiredAudience
I found a very helpful post on stackoverflow about more or less the same issue, for Java instead of node.js: It looks like there is a mismatch between projectId and clientId.
I changed my gitkit-server-config.json file to swap the projectId and clientId values and it worked!
This sound very much like a major bug on google side, doesn't it?
Why does it work on localhost?
Will this be changed/fixed in the future?
Maybe the problem is in the tutorial?
I have a working solution for now, but I do not feel safe to keep it like that...
I hope a googler will read this!
[EDIT]
Following wyhao31's comment I had a closer look at the gitkitclient.js source code and both projectId and clientId are added to the same audiences array.
After more test I found out that you must only put the project ID ('my-project-name') in the gitkit-server-config.json file.
The nasty thing is that if you add it with a 'clientId' property name it is also working...
Based on your description, and if you read gitkit-server-config.json file like this
var gitkitClient = new GitkitClient(JSON.parse(fs.readFileSync('./gitkit-server-config.json')));
I think the problem might caused by using old nodejs client lib. Could you try to update your client lib to latest version(0.0.6)? Or you can use the code directly.
I've tried to get the setUserContext function with raven-node in my nodejs app, but I cannot find how to set the user context. Has anyone made it work?
I was able to make it work in the client-side, with "Raven.setUserContext" but not in the nodejs backend :(
User context isn't implemented in raven-node: https://github.com/getsentry/raven-node/issues/134
I'm a contributor to the project, and it's my number one priority to have this done shortly – should be a matter of days.
Edit – we just published raven-node 0.10.0 which adds setUserContext.