feathersjs-ecosystem / feathers-vuex

Integration of FeathersJS, Vue, and Nuxt for the artisan developer
https://vuex.feathersjs.com
MIT License
445 stars 110 forks source link

Uncaught (in promise) TypeError: Cannot convert undefined or null to object #156

Closed joeinnes closed 5 years ago

joeinnes commented 6 years ago

Also logged with Feathers: https://github.com/feathersjs/authentication-client/issues/108 @petebytes has created a repo: https://github.com/petebytes/trello-clone.git

Steps to reproduce

(First please check that this issue is not already solved as described here)

Expected behavior

When dispatching a create action, the access token should be populated onto the request, and the request sent to the server for processing.

Actual behavior

When dispatching a create action, there's an error when trying to populate the access token, and the request does not get sent to the server:

TypeError: Cannot convert undefined or null to object
    at Function.assign (<anonymous>)
    at Object.eval (populate-access-token.js?39da:9)
    at promise.then.hookObject (hooks.js?8408:142)

In particular, it seems to be the case that the hook.params is undefined, so when calling Object.assign, it fails.

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

  "dependencies": {
    "@feathersjs/authentication-client": "^1.0.4",
    "@feathersjs/feathers": "^3.2.1",
    "@feathersjs/rest-client": "^1.4.3",
    "@feathersjs/socketio-client": "^1.1.2",
    "axios": "^0.18.0",
    "feathers-vuex": "^1.4.8",
    "hellojs": "^1.17.1",
    "socket.io-client": "^2.1.1",
    "vue": "^2.5.17",
    "vue-router": "^3.0.1",
    "vuetify": "^1.0.19",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@babel/polyfill": "^7.0.0-beta.49",
    "@vue/cli-plugin-babel": "^3.0.1",
    "@vue/cli-plugin-eslint": "^3.0.1",
    "@vue/cli-service": "^3.0.1",
    "@vue/eslint-config-standard": "^3.0.1",
    "lint-staged": "^7.2.2",
    "vue-cli-plugin-vuetify": "^0.1.6",
    "vue-template-compiler": "^2.5.17"
  },

NodeJS version: 9.4.0

Operating System: macOS High Sierra

Browser Version: 68.0.3440.106 (Official Build) (64-bit)

React Native Version: Not using React Native

Module Loader: vue-cli-service (ie: webpack)

joeinnes commented 6 years ago

Seems a change has been implemented upstream requiring you to pass params:

https://github.com/feathersjs/authentication-client/issues/108#issuecomment-421334346

wdmtech commented 5 years ago

Just came across this myself. Calling

todo.save() on a FeathersVuexModel caused this error, but

todo.save({}) works

joeinnes commented 5 years ago

Is this also thrown from the populateAccessToken.js file in the Feathers authentication client? If so, I put in a PR earlier today for this.

On Sat, 15 Sep 2018, 13:09 Will Murray, notifications@github.com wrote:

Just came across this myself. Calling

todo.save() on a FeathersVuexModel caused this error, but

todo.save({}) works

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/feathers-plus/feathers-vuex/issues/156#issuecomment-421553282, or mute the thread https://github.com/notifications/unsubscribe-auth/AEfHRa57pjPqxJscISVn3FnmVcVY2QFBks5ubN_agaJpZM4WgUEe .