perfood / couch-auth

Powerful authentication for APIs and apps using CouchDB (or Cloudant) with Node >= 14
MIT License
66 stars 19 forks source link

Having issue to retrieve user information after success user create #52

Closed Sourav-techlur closed 1 year ago

Sourav-techlur commented 1 year ago

Hello,

I am having an issue, when i try to get the newly created user i am getting error 404 to repeat please follow the following steps 1) Create a new user with createUser method 2) after getting the response get the newly created user with getUser method

Package information "@perfood/couch-auth": "^0.18.1", "nano": "^10.0.0",

Error Error: missing at responseHandler (/Users/mohan/cibos-server/node_modules/nano/lib/nano.js:188:20) at /Users/mohan/cibos-server/node_modules/nano/lib/nano.js:427:13 at processTicksAndRejections (node:internal/process/task_queues:96:5) { scope: 'couch', statusCode: 404, request: { method: 'get', headers: { 'content-type': 'application/json', accept: 'application/json', 'user-agent': 'nano/10.0.0 (Node.js v16.13.0)', 'Accept-Encoding': 'deflate, gzip' }, auth: { username: 'XXXXXX', password: 'XXXXXX' }, qsStringifyOptions: { arrayFormat: 'repeat' }, url: 'http://localhost:5984/cibos-users/506c8f93227d42aa8c827ce7a766b1c4', params: undefined, paramsSerializer: [Function (anonymous)], data: undefined, maxRedirects: 0, httpAgent: Agent { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, defaultPort: 80, protocol: 'http:', options: [Object: null prototype], requests: [Object: null prototype] {}, sockets: [Object: null prototype], freeSockets: [Object: null prototype], keepAliveMsecs: 30000, keepAlive: true, maxSockets: 50, maxFreeSockets: 256, scheduling: 'lifo', maxTotalSockets: Infinity, totalSocketCount: 3,

},
httpsAgent: Agent {
  _events: [Object: null prototype],
  _eventsCount: 2,
  _maxListeners: undefined,
  defaultPort: 443,
  protocol: 'https:',
  options: [Object: null prototype],
  requests: [Object: null prototype] {},
  sockets: [Object: null prototype] {},
  freeSockets: [Object: null prototype] {},
  keepAliveMsecs: 30000,
  keepAlive: true,
  maxSockets: 50,
  maxFreeSockets: 256,
  scheduling: 'lifo',
  maxTotalSockets: Infinity,
  totalSocketCount: 0,
  maxCachedSessions: 100,
  _sessionCache: [Object],
  [Symbol(kCapture)]: false
}

}, headers: { uri: 'http://localhost:5984/cibos-users/506c8f93227d42aa8c827ce7a766b1c4', statusCode: 404, 'cache-control': 'must-revalidate', 'content-type': 'application/json', date: 'Tue, 30 Aug 2022 11:16:35 GMT', 'x-couch-request-id': '495c245552', 'x-couchdb-body-time': '0' }, errid: 'non_200', description: 'missing', error: 'not_found', reason: 'missing' }

fynnlyte commented 1 year ago

Maybe have a look at #25? createUser probably resolves too early and you'd need to wait for the signup - event to emit before the user is in the DB

Sourav-techlur commented 1 year ago

Thank you @LyteFM I will modify the API accordingly.