Reputation: 115
I made the following npm package updates to my project:
vuex: 2.3.1 -> 3.0.0
vue: 2.4.2 -> 2.5.2
vue-router: 2.7.0 -> 3.0.1
(and some more but I don't consider them relevant to this issue)
And now I get this error upon starting up my webpage:
Error: [vuex] actions should be function or object with "handler" function but "actions.default" is {}
I am not so sure why, I read the Vuex changelog and the syntax does not really seem to have changed, but for some reason my code crashes.
Upon examining this issue closer I found out that the error is generated by a failed assertion in a file called vuex.esm.js:
function assert (condition, msg) {
if (!condition) { throw new Error(("[vuex] " + msg)) }
}
The code worked fine before updating the packages, there is probably something I am missing here. I am happy to provide any code that might help understand the issue better.
Thanks!
EDIT: Here is the Call stack that leads to the error:
Upvotes: 2
Views: 4233
Reputation: 258
I experienced the same error in my unit tests. I just added a empty handler
function to my actions and it worked after that...
const state = { auth: { authenticated: false } };
const actions = { auth: { handler: () => {}, logout: () => sinon.stub() } };
let store;
beforeEach(() => {
store = new Vuex.Store({
state,
actions,
});
});
Upvotes: 6