Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

queryWithCurrentUser Generating the following error There is no current user to associate. #43

Closed
abalad opened this issue Mar 3, 2018 · 2 comments · Fixed by #59
Closed

Comments

@abalad
Copy link
Contributor

abalad commented Mar 3, 2018

{
    "name": "GeneralError",
    "message": "There is no current user to associate.",
    "code": 500,
    "className": "general-error",
    "data": {},
    "errors": {}
}
const { authenticate } = require('@feathersjs/authentication').hooks;
const hooks = require('feathers-authentication-hooks');

module.exports = {
  before: {
    all: [],
    find: [
      function(context){ console.log(context) },
      hooks.queryWithCurrentUser({ idField: 'id', as: 'usuario_id' })
    ],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  },

  after: {
    all: [],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  },

  error: {
    all: [],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  }
};

@daffl
Copy link
Member

daffl commented Apr 20, 2018

There has to be a params.user, which is usually added by the authenticate() hook.

@daffl daffl closed this as completed Apr 20, 2018
@abalad
Copy link
Contributor Author

abalad commented Apr 20, 2018

I've created an implementation suggestion #49

This was referenced Aug 16, 2018
@daffl daffl reopened this Aug 21, 2018
@daffl daffl closed this as completed in #59 Aug 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants