Push command creating error: Cannot read property 'replace' of undefined - firebase

I've seen variations of this question in the context of everything from AngularJS to KendoGrid to BackboneJS but all the answers are related to those frameworks and none of them address this directly at a straight-up Firebase level. Since I'm not using any of those, the answers are not helpful to me.
I create the following ref:
var loginRef = new Firebase('https://f30s.firebaseio.com/Pablo/pages/login');
I try the following push:
loginRef.child('clientEvents').push( { Create_account : true } );
The push writes to Firebase in the proper directory structure, but console produces the error:
Uncaught TypeError: Cannot read property 'replace' of undefined
What am I doing wrong?

Related

Store: TypeError: Cannot read properties of undefined (reading 'ids') at selectIds

What is causing the issue in the title. I am basically getting a typeError when I try to retrieve data in a feature store module.
The issue was that I configurated wrongly the reducers in the StoreModule.forRoot inside the app.module.ts (I had multiple reducers so it should be declared in an object)

Gremlin Translator returning error: "Cannot read property 'length' of undefined"

I'm trying to use the Translator feature as described here:
https://tinkerpop.apache.org/docs/3.4.11/reference/#translators
But I get an error: "Cannot read property 'length' of undefined"
I traced it back to this line in the Gremlin source:
https://github.com/apache/tinkerpop/blob/b84c3ece2a584f6634f1586f4b84c4e1c349595d/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/translator.js#L53
It looks like instructions is coming back undefined.
Here is the code I'm testing with:
const traversal = g.V().hasLabel("user").limit(1);
const translator = new gremlin.process.Translator("g");
console.log(translator.translate(traversal));
This is happening with "gremlin": "3.5.0". Is this a bug or am I using this feature incorrectly?
You are doing what the documentation says and I think that's the desired way the Translator should be used but the translate() function actually requires a Bytecode object therefore proper usage should be:
const traversal = g.V().hasLabel("user").limit(1);
const translator = new gremlin.process.Translator("g");
console.log(translator.translate(traversal.getBytecode()));
So, the documentation is wrong in the sense that it really shows the desired API rather than the actual API. For now, you will need to call it as shown above, but I've already pushed a fix for the next release that will allow it to be called as shown in the documentation.

TypeError: Cannot read property 'only' of undefined

I am trying to use React Testing Library for my React project but it errors when trying to mount a component that imports CreatCanBountTo with the error:
TypeError: Cannot read property 'only' of undefined
> 1 | const { createCanBoundTo } = require('#casl/react');
I assume that it's due to casl not being initialised before the test runs.
Thank you in advanced for your help.

can you use tinytest to test a package that uses other packages

I have some tinytests, simple server unit tests.
Separately they run fine, but if i run them together I get errors on my collections.
What else might cause an error like the below?
I think its related to defining the exports in a JS file and the other classes in coffeescript and some scoping issue is complicating things. "Told you not to use coffeescript" i hear. But then again, it maybe something else!
os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20150418-17:39:20.312(-7)? (STDERR) throw(ex);
^
Error: A method named '/Profiles/insert' is already defined
at packages/ddp/livedata_server.js:1461:1
at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
at [object Object]._.extend.methods (packages/ddp/livedata_server.js:1459:1)
at [object Object].Mongo.Collection._defineMutationMethods (packages/mongo/collection.js:90
at new Mongo.Collection (packages/mongo/collection.js:209:1)
at [object Object].Meteor.Collection (packages/dburles:collection-helpers/collection-helper
at __coffeescriptShare (packages/local-test:dcsan:mpgames/lib/exports.js:2:1)
at /private/var/folders/lw/6kdr1_9j3q1ggldr_c798qy80000gn/T/meteor-test-run126tw73/.meteor/
FWIW the app has no problems running, its just the tests that fail.
This error means you defined the Profiles collection more than once. My strategy in dealing with this problem has been to:
Use a global definition via api.export for any collections which actually should be defined by a package (e.g. if the posts package defined a Posts collection).
Define all other collections needed by the test with a null collection name (unmanaged) and use a reset like the following before each test:
var resetCollection = function(name) {
var Collection = this[name];
if (Collection)
// if the collection is already defined, remove its documents
Collection.remove({});
else
// define a new unmanaged collection
this[name] = new Mongo.Collection(null);
};
So if you call resetCollection('Posts') it would only define a new collection if needed and ensure its documents were removed. This way, you'll avoid multiple definitions and you'll start with a clean DB each time.

Backbone.js binding (BackFire) model destroy function not working

I get the following error when i try to call destroy function to my Backbone Model:
Uncaught TypeError: Cannot call method 'apply' of undefined backbone-firebase.js:126
Backbone.Firebase.sync backbone-firebase.js:126
Backbone.sync backbone-firebase.js:154
h.extend.sync backbone-min.js:1
h.extend.destroy backbone-min.js:1
Backbone.View.extend.remove sample.html:79
p.event.dispatch jquery.min.js:2
g.handle.h
Code: http://dl.dropboxusercontent.com/u/14749491/sample.html
Since you're using the "implicit" sync method, don't use destroy to remove the model, use the remove method on the collection instead.
If you'd like to use destroy, I recommend using the "explicit" sync method,,using Backbone.Collection.extend with a firebase property. More information on these two methods here: https://github.com/firebase/backfire
I don't know anything about BackFire. But it appears to be a conflict between FireBase and BackBone-FireBase. Since the code you are loading from the FireBase cdn is minified method names (like delete in this case) have been changed. Try using the unminified version of FireBase and see if it works correctly.

Resources