Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authManagement:verifySignupLong Sequelize error "Invalid value [object Object]" #75

Closed
hirenchauhan2 opened this issue Oct 18, 2017 · 2 comments

Comments

@hirenchauhan2
Copy link

payload

{
	"action": "verifySignupLong",
	"value": "3ef3ee3d7d21d8a87d1f701be85287"
}

API Result

{
	"name": "GeneralError",
	"message": "Invalid value [object Object]",
	"code": 500,
	"className": "general-error",
	"data": {},
	"errors": {}
}

The error at server

info: after: users - Method: find
info: error: users - Method: patch: Invalid value [object Object]
error:  Error: Invalid value [object Object]
    at Object.escape (app\node_modules\sequelize\lib\sql-stri
    ng.js:50:11)
    at Object.escape (app\node_modules\sequelize\lib\dialects\abstract\query-generator.js:919:22)
    at Object.updateQuery (app\node_modules\sequelize\lib\dialects\abstract\query-generator.js:360:58)
    at QueryInterface.bulkUpdate (app\node_modules\sequelize\lib\query-interface.js:944:37)
    at Promise.try.then.then.then.results(app\node_modules\sequelize\lib\model.js:2760:34)at tryCatcher (app\node_modules\bluebird\js\release\util.
    js:16:23)
    at Promise._settlePromiseFromHandler (app\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (app\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (app\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (app\node_modules\bluebird\js\release\promise.js:693:18)
    at Async._drainQueue (app\node_modules\bluebird\js\release\async.js:133:16)    
    at Async._drainQueues (app\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (app\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)
    at processImmediate [as _immediateCallback] (timers.js:714:5)
info: error: authManagement - Method: create: Invalid value [object Object]
error:  Error: Invalid value [object Object]
    at Object.escape (app\node_modules\sequelize\lib\sql-stri
ng.js:50:11)
    at Object.escape (app\node_modules\sequelize\lib\dialects\abstract\query-generator.js:919:22)
    at Object.updateQuery(app\node_modules\sequelize\lib\dialects\abstract\query-generator.js:360:58)
    at QueryInterface.bulkUpdate(app\node_modules\sequelize\lib\query-interface.js:944:37)
    at Promise.try.then.then.then.results (app\node_modules\sequelize\lib\model.js:2760:34)
    at tryCatcher (app\node_modules\bluebird\js\release\util.
js:16:23)
    at Promise._settlePromiseFromHandler (app\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (app\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0(app\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises(app\node_modules\bluebird\js\release\promise.js:693:18)
    at Async._drainQueue (app\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (app\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (app\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)
    at processImmediate [as _immediateCallback] (timers.js:714:5)

I am using Sequelize with MariaDB and sequelize-json for verifyChanges JSON field.

The verifySignupLong action requires { value: verifyToken} and not value: { verifyToken }.

Still I am not able to figure out what problem is as passed params are as per the requirement of function.

One question comes in my mind is that is this service made specifically for MongoDB like databases?
because the tutorial I saw used mongo and the fields are also not very much in favor of MySQL or MariaDB.

Here is the client side code:

const app = feathers()
  .configure(feathers.hooks())
  .configure(feathers.rest('http://localhost:3030').axios(window.axios)); // used fetch too but no success

const authManagement = app.service('authManagement');

const appComp = new Vue({
  el: '#verifySignup',
  data: {
    showAlert: false,
    verified: false,
    message: '',
    verifyToken: ''
  },
  mounted: function() {
    this.verifyToken = document.querySelector('#verificationToken').value.toString();
    console.log('Got verifyToken: ', this.verifyToken);
  },
  methods: {
    verifySignup: function() {
      if(!this.verifyToken) { return false; }
      const token = this.verifyToken;
     
      // fetch('/authManagement', {
      //   method: 'POST', headers: { Accept: 'application/json' },
      //   body: JSON.stringify({ action: 'verifySignupLong', value: token})
      // }).then(res => res.json())

      authManagement.create({
        action: 'verifySignupLong',
        value: token
      })
        .then(result => {
          this.verified = true;
          this.message = 'Your email has been verified. Please log in to app!';
          this.showAlert = true;
          log('Success ', result);
        })
        .catch(err => {
          this.message = 'Sorry, but we could not verify your email.';
          this.verified = false;
          this.showAlert = true;
          log('Error ',err);
        });
    }
  }
});

package.json:

{
    "feathers": "^2.1.7",
    "feathers-authentication": "^1.2.7",
    "feathers-authentication-hooks": "^0.1.4",
    "feathers-authentication-jwt": "^0.3.2",
    "feathers-authentication-local": "^0.4.4",
    "feathers-authentication-management": "^1.0.0",
    "feathers-authentication-oauth2": "^0.2.5",
    "feathers-configuration": "^0.4.1",
    "feathers-errors": "^2.9.1",
    "feathers-hooks": "^2.0.2",
    "feathers-hooks-common": "^3.7.2",
    "feathers-mailer": "^2.0.0",
    "feathers-populate-hook": "^0.2.3",
    "feathers-rest": "^1.8.0",
    "feathers-sequelize": "^2.3.1",
    "mysql2": "^1.4.2",
    "sequelize": "^4.11.1",
    "sequelize-json": "^2.1.2",
}

NodeJS version: 8.5.0
Operating System: Windows 8.1 64Bit

@hirenchauhan2 hirenchauhan2 changed the title authManagement:verifySignupLong error "Invalid value [object Object]" authManagement:verifySignupLong Sequelize error "Invalid value [object Object]" Oct 19, 2017
@eddyystop
Copy link
Collaborator

I think this addresses your issue #44

@eddyystop
Copy link
Collaborator

This is covered in the a-l-m rewrite of this repo. Full details at https://github.com/feathers-plus/authentication-local-management/blob/master/misc/upgrading.md

Please add any further comments in a-l-m.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants