Using firebase-admin 5.0.0, I get this exception when I debug in vscode 1.12.2 running node 7.10.0
Exception has occurred: Error
SyntaxError: Unexpected token ɭ in JSON at position 0
at Object.parse (native)
at eb (c:\Users\...\node_modules\firebase-admin\lib\database\database.js:57:267)
at wc (c:\Users\...\node_modules\firebase-admin\lib\database\database.js:77:489)
at yc (c:\Users\...\node_modules\firebase-admin\lib\database\database.js:77:708)
at kh.h.hf (c:\Users\...\node_modules\firebase-admin\lib\database\database.js:224:146)
at c:\Users\...\node_modules\firebase-admin\lib\database\database.js:239:186
at c:\Users\...\node_modules\firebase-admin\lib\firebase-app.js:82:25
at Array.forEach (native)
at c:\Users\...\node_modules\firebase-admin\lib\firebase-app.js:81:43
at process._tickCallback (internal/process/next_tick.js:109:7)
Here is the javascript I'm running
'use strict';
if (!process.env.FIREBASE_PROJECT_ID) {
require('dotenv').config({ silent: true });
}
const fbConfig = require('./firebase-config');
const admin = require('firebase-admin');
admin.initializeApp({
credential: admin.credential.cert(fbConfig.FIREBASE_SERVICE_ACCOUNT),
databaseURL: fbConfig.APP_SETTINGS.databaseURL
});
const db = admin.database();
let obj = {foo:'bar'};
let ref = db.ref('test');
ref.set(obj, function (error) {
console.log(error);
console.log('complete');
});
The exception happens here in database.js
function eb(a) {
return "undefined" !== typeof JSON && n(JSON.parse) ? JSON.parse(a) : xa(a)
}
When I hit the exception, I can see that the value of a
is "ɭ�". If I continue, another similar exception is thrown, and the operation eventually completes successfully with the error value being null.
Any idea what is going on here?
via brainbolt
No comments:
Post a Comment