How can I force Firebase Realtime Database URL without "default-rtdb" - node.js

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

Related

auth0 custom DB connection Postgres Connection Error

We are using auth0 for user authentication & authorization, and configured custom DB with postgresDB.
Auth0 account is using node 16 as runtime engine for running custom DB scripts.
Loaded postgres template and modified with required changes.
When testing the script, it was giving error saying postgres.connection is not a function.
The same code works well for other account which have node 12 as runtime.
Any suggestions?
This is common issue when using old version of pg.
Latest pg version supported in Auth0 is 8.7.1
Ref: https://auth0-extensions.github.io/canirequire/#pg
So you can update the statement
require('pg')
to
require('pg#8.7.1')
Also please refere https://node-postgres.com/apis/client for correct way to use the Client from pg.

BIM360 Issues editor Forge Node JS App -trying to run on localhost 3000

I am trying to work with the BIM 360 Issue Editor created by Petr and available on github https://github.com/petrbroz/bim360-issue-editor/tree/develop
I have added all the dependencies,etc. but seem to be stuck with the configuration.
I am testing on local host and I am getting invalid URI error, what would be the correct configuration variables for launch.json file for
"HOST_URL": "http://localhost:3000","SERVER_SESSION_SECRET","CLI_CONFIG_PASSWORD"
Also there is SENDGRID_API_KEY required, which throws an error on the console, I add the key from SendGrid in config.js, and the error goes away. Is it correct?
Please suggest. Thanks
Here's more details about the env. variables:
HOST_URL is just the host/port the app is listening on (for example, http://localhost:3000)
This value is used to built the callback URL for the 3-legged OAuth workflow; for example, if the host URL is http://localhost:3000, the callback URL will be http://localhost:3000/auth/callback
Note that the same callback URL must be configured for your Forge app on https://forge.autodesk.com/myapps
SERVER_SESSION_SECRET is an arbitrary string that will be used to encrypt/decrypt browser cookies
CLI_CONFIG_PASSWORD is only needed when you want to use the command-line utility that's part of the sample code; in that case the configuration for the CLI utility will be zipped in a password-protected *.zip file using this env. variable as the password
SENDGRID_API_KEY is also optional and only needed if you want the app to send email notifications to users who triggered the Excel export

How do i use the Kenitco API from a Console App

I'm using Kentico V10 and I can run the website locally. However, when i try to use the API from a console app, i'm getting the following error.
{"Object type 'cms.class' not found."}
The stackTrace has a call to check license. I'm following this page, and it says you have to add a license for your domain, but what domain is used when you are running from a console app?
https://docs.kentico.com/k10/integrating-3rd-party-systems/using-the-kentico-api-externally
I'm using this code from taken from this page.
https://docs.kentico.com/k10/managing-users/user-registration-and-authentication/configuring-single-sign-on
CMS.DataEngine.CMSApplication.Init();
string userName = "myuser";
// Gets the user with the specified user name
UserInfo userInfo = UserInfoProvider.GetUserInfo(userName);
// Gets the authentication URL for a specified user and target URL
string url = AuthenticationHelper.GetUserAuthenticationUrl(userInfo, "SecuredSurvey");
If that was available via the REST API, i'd be happy to get the URL that way, but from what i can see, it's not available.
-Randy
Kentico has some good documentation on how to use the API in an external application, specifically a console library here.
Very notable steps are:
Connecting to the database; make sure you use the same connection string as in your web.config
Install the Kentico.Libraries NuGet package
Initialize Kentico in your application in the Global.asax file.
Write custom code all day long.

Firebase-admin fails silently to write to realtime database from nodejs

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,

Azure Mobile Service (node backend) __updatedAt property not automatically set after edit

After reading the documentation I was expecting that this field is automatically set by Azure Mobile Services. Apparently it isn't.
Should I configure something extra?
Other options that I see (to do for each table):
* add an axtra line to the node js update(item, user, request) function:
item.__updatedAt = new Date();
* create an update trigger in the database
Anybody experience with this?
Thx!
The __updatedAt column is updated by a trigger created in the underlying SQL Server database, so it should be updated any time a row is updated. Note that this requires a database operation to occur for it to be updated.

Resources