emberfire: this._ref.push is not a function - javascript

The Issue
I seem to be getting the following error with emberfire, I followed the documentation yet still get the error:
Uncaught TypeError: this._ref.push is not a function
at Class.generateIdForRecord (firebase.js:75)
at Class._generateId (-private.js:10359)
at Class.createRecord (-private.js:10325)
at Class.test (home.js:13)
at Class.send (action_handler.js:32)
at action.js:141
at exports.flaggedInstrument (ember-metal.js:3730)
at action.js:140
at Backburner.run (backburner.js:537)
at run (ember-metal.js:4267)
The following code is where the error comes from, the code is simply placed in an action in a controller called home:
var newGlobal = this.store.createRecord('global', {
about: 'test',
});
newGlobal.save();
The rules on the database are set up as:
{
"rules": {
".read": true,
".write": true
}
}
and the database is empty.
I have also setup config/environment.js
Any ideas please?
Thank you in advance
Helpful Links
emberfire
Emberfire guide
Found these issues but they didn't help with my issue

This is now solved, the issue was I had created a custom ember service called firebase.
I had injected it in the home controller like so:
firebase: Ember.inject.service()

Related

Nest JS Cannot read property of undefined

My application was working fine, and it stopped after trying to get the documentation with swagger, i think it may be a dependency issue, but can't find it anywhere.
I keep getting the error
10:10:22 PM - Starting compilation in watch mode...
Error Cannot read property 'getSymbol' of undefined
I don't know where getSymbol is used, and the error doesn't seem to help much. Hope someone can help me fix this issue. The complete application code can be found at:
https://github.com/JSLearningCode/enderecosAlunosAPI
Any help is welcome.
EDIT:
Running in dev mode I got this output:
/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/typescript/lib/typescript.js:95877
throw e;
^
TypeError: Cannot read property 'getSymbol' of undefined
at Object.isArray (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/utils/ast-utils.js:6:25)
at getTypeReferenceAsString (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/utils/plugin-utils.js:12:21)
at Object.getTypeReferenceAsString (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/utils/plugin-utils.js:31:29)
at ControllerClassVisitor.createTypePropertyAssignment (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:51:44)
at ControllerClassVisitor.createDecoratorObjectLiteralExpr (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:38:18)
at ControllerClassVisitor.addDecoratorToNode (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:29:22)
at visitNode (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:16:29)
at visitNodes (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/typescript/lib/typescript.js:70998:48)
at Object.visitEachChild (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/typescript/lib/typescript.js:71266:355)
at visitNode (/home/william/Documentos/lemobs/enderecosAlunosAPI/node_modules/#nestjs/swagger/dist/plugin/visitors/controller-class.visitor.js:18:23)
error Command failed with exit code 1.
There was an issue related to the routing in the application. I had a parser inside the controller that was used for directing correct routes between a route "aluno" with first Param.
Once I had taken the route with no params and put it first at the controller, there was no need anymore for the parser, and the issue was gone. Hope this answer helps more people if they get the same problem.
Please check your method result type of controller
Change this:
#Contoller()
export class MyController {
// ...
async myMethod() {
return {}
}
}
to:
#Contoller()
export class MyController {
// ...
async myMethod():Promise<any> {
return {}
}
}

ngCordova: Uncaught ReferenceError: Connection is not defined

Trying to figure out this error in my Ionic app for checking network connection. Im using ngCordova's network tools found here :
http://ngcordova.com/docs/plugins/network/
ngCordova claims that their $cordovaNetwork.isOnline() function works but I'm finding quite the opposite. $cordovaNetwork.getNetwork seems to work fine but otherwise, I am getting this error when executing console.log($cordovaNetwork.inOnline()); in the code.
I've seen answers to this issue elsewhere but none of them involve using this function. They involve using a states array or 'online/offline' events.
Can someone explain why isOnline() || isOffline() doesn't seem to work? How can I use this function accordingly without any circus tricks? I am debugging via Android. I am injecting properly and doing other things properly in the code. Any help is appreciated. Thanks.
To Solve this, I had 2 workarounds for this problem
1- In Cordova/service.
this.isOffline = function() {
if (navigator.connection && typeof Connection !== 'undefined') {
me.offline = $cordovaNetwork.isOffline();
return me.offline;
}
return me.offline;
};
2- Include a new file connection.js in index.html(first js file) with below content
var Connection = {
UNKNOWN: "unknown",
ETHERNET: "ethernet",
WIFI: "wifi",
CELL_2G: "2g",
CELL_3G: "3g",
CELL_4G: "4g",
CELL:"cellular",
NONE: "none"
};
there may be one more reason for this problem i.e ngCordova is firing up before the device is ready.
console.log($cordovaNetwork.inOnline());
It must be isOnline.You have a typo here.It is wrong copy paste or you have this in the code?

Meteor server throws error with Accounts.addEmail() in a meteor method

I need help figuring out why I am getting this error.
My method is defined in app/server/methods.js
Meteor.methods({
myMethod: function(user) {
Accounts.addEmail(user._id, "thisemail#email.com", true); // set verified to true
}
});
My template has an event that is calling this method from the client.
Template.myTemplate.events({
'click #this-button': function(e) {
Meteor.call("myMethod", userObject, function(error, result) {
if (error) {
console.log(error);
} else {
// do something here
}
});
}
});
I keep getting an Internal Server Error [500] error back to the console.
When I check my server output it says:
Exception while invoking method 'myMethod' TypeError: Object #<Object> has no method 'addEmail'.
Can anyone help me figure out why it can't be found/used?
These are the list of packages I am using, and I thought this came packaged with the accounts-password package according to the Meteor Documentation here.
meteor-platform
iron:core
iron:router
less
zimme:iron-router-active
tomi:upload-server
tomi:upload-jquery
houston:admin
coffeescript
alanning:roles
edgee:slingshot
joshowens:accounts-entry
mystor:device-detection
underscore
email
accounts-password
If I'm reading the commit history correctly, it looks like addEmail was added here as part of meteor 1.2.
The docs always reference the latest version, but your app is using version 1.1, which explains the missing function.
The solution may be as simple as running meteor update, however accounts-entry is ancient and it may be incompatible with meteor 1.2, as noted in this issue.
If you can't or don't want to update, just leave a comment and I can suggest an alternative implementation.

I am getting undefined with Papaparse

So when I try to read the variable on complete with papaparse i get the following error: TypeError: wpcc_results is undefined.
I really cannot see what is wrong with my code here:
$('.wpcc_gen_box_form').submit(function(event) {
// stop the form from submitting the normal way and refreshing the page
event.preventDefault();
$('#wpcc_csv_file').parse({
complete: function(wpcc_results) {
console.log(wpcc_results.data);
}
});
});
I think fresh eyes would really help here.
I appreciate any help.
The solution is in fact to define the complete function within the config. As that is where the parameters are actually passed. Answer was found here: https://github.com/mholt/PapaParse/issues/168

what is this angular error?

Just made a simple controller with some injection.
var SimpleProductListController = BaseController.extend({
_notifications:null,
_productsModel:null,
init:function($scope,ProductsModel,$route){
},
defineListeners:function(){
this._super();
},
destroy:function(){
}
})
/...
SimpleProductListController.$inject = ['$scope','ProductsModel','$route'];
The console error points to this:
http://errors.angularjs.org/1.2.16/ng/areq?p0=SimpleProductListController&p1=not%20aNaNunction%2C%20got%20undefined
Argument 'SimpleProductListController' is not aNaNunction, got undefined
How am I supposed to even debug this? I got batarang but it does nothing here.
Basically, Angular is saying that SimpleProductListController is undefined.
When I've gotten that error, it was because I created a controller and tried to inject it into my app but I did not load the file that defines that controller by adding the script tag to my index.html file.

Categories

Resources