Reputation: 186
Any help appreciated.
Currently developing on localhost.
Date and time are in sync.
Latest firebase-admin installed.
This was working absolutely fine one day and not the next. (No changes).
Terminal output:
@firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential","message":"Credential implementation provided to initializeApp() via the \"credential\" property failed to fetch a valid Google OAuth2 access token with the following error: \"unable to verify the first certificate\"."}
This is the begining of the app.js
:
//requires
var radius = require("radius");
var dgram = require("dgram");
var admin = require("firebase-admin");
//for CHAP hashing
var crypto = require("crypto");
//Load additional radius dictionaries
radius.add_dictionary('./radius_dictionaries');
//init firebase
var serviceAccount = require("./serviceKey.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://<database>.firebaseio.com/"
});
//init db object
var db = admin.database();
This app does not present an HTTPS webpage, or and HTTPS end point for http requests. Simply connects to the Firebase database and reads data.
Upvotes: 2
Views: 3573
Reputation: 186
Started a clean app and had an issue where I couldn't even install firebase-admin
.
With a bit of digging I noticed that node-pre-gyp
was throwing alot of stack errors while trying to build, and node couldn't find my local python install (despite being installed).
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with
exit code: 1
gyp ERR! stack at ChildProcess.onExit
(C:\Users\Jonth\AppData\Roaming\npm\node_modules\npm\node_modules\node-
gyp\lib\build.js:262:23)
And certificate errors again
node-pre-gyp WARN Hit error unable to verify the first certificate
So what I did to fix the issue was:
RUN
npm install --global --production windows-build-tools
AND RUN
This is what really fixed the issue
set NODE_TLS_REJECT_UNAUTHORIZED=0
I can now run my app and continue with development.
Why I needed to do this I don't honestly know.
If someone could enlighten me, I'm all ears.
I can only hope this doesn't effect my app when it gets deployed to the Google cloud.
FYI, development PC is Windows 10 Pro
Upvotes: 1