You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm using a windows 10 machine and experiencing app failure when a todo is added.
here is the console:
Asset Size Chunks Chunk Names
bundle.js 2.58 MB 0 [emitted] [big] bundle
bundle.css 5.89 kB 0 [emitted] bundle
bundle.js.map 2.81 MB 0 [emitted] bundle
bundle.css.map 16.5 kB 0 [emitted] bundle
webpack: Compiled successfully.
ERR
ERR ValidationError: createdBy: Cast to ObjectID failed for value "{}" at path "createdBy"
at new ValidationError (C:\Users\user\mobx1\node_modules\mongoose\lib\error\validation.js:28:11)
at model.Document.invalidate (C:\Users\user\mobx1\node_modules\mongoose\lib\document.js:1612:32)
at model.Document.set (C:\Users\user\mobx1\node_modules\mongoose\lib\document.js:761:10)
at model._handleIndex (C:\Users\user\mobx1\node_modules\mongoose\lib\document.js:594:14)
at model.Document.set (C:\Users\user\mobx1\node_modules\mongoose\lib\document.js:554:24)
at model.Document (C:\Users\user\mobx1\node_modules\mongoose\lib\document.js:73:12)
at model.Model (C:\Users\user\mobx1\node_modules\mongoose\lib\model.js:47:12)
at new model (C:\Users\user\mobx1\node_modules\mongoose\lib\model.js:3698:13)
at C:/Users/user/mobx1/server/routes/todos.js:22:19
at new Promise ()
at addTodos (C:/Users/user/mobx1/server/routes/todos.js:17:8)
at dispatch (C:\Users\user\mobx1\node_modules\koa-router\node_modules\koa-compose\index.js:44:32)
at next (C:\Users\user\mobx1\node_modules\koa-router\node_modules\koa-compose\index.js:45:18)
at C:\Users\user\mobx1\node_modules\koa-router\lib\router.js:346:16
at dispatch (C:\Users\user\mobx1\node_modules\koa-router\node_modules\koa-compose\index.js:44:32)
at C:\Users\user\mobx1\node_modules\koa-router\node_modules\koa-compose\index.js:36:12
(NOTE: i registered and logged in first)
console message (from the code below) shows ctx.account.id is undefined and account.token is ok.
i'm using a windows 10 machine and experiencing app failure when a todo is added.
here is the console:
Asset Size Chunks Chunk Names
bundle.js 2.58 MB 0 [emitted] [big] bundle
bundle.css 5.89 kB 0 [emitted] bundle
bundle.js.map 2.81 MB 0 [emitted] bundle
bundle.css.map 16.5 kB 0 [emitted] bundle
webpack: Compiled successfully.
ERR
ERR ValidationError: createdBy: Cast to ObjectID failed for value "{}" at path "createdBy"
at new ValidationError (C:\Users\user\mobx1\node_modules\mongoose\lib\error\validation.js:28:11)
at model.Document.invalidate (C:\Users\user\mobx1\node_modules\mongoose\lib\document.js:1612:32)
at model.Document.set (C:\Users\user\mobx1\node_modules\mongoose\lib\document.js:761:10)
at model._handleIndex (C:\Users\user\mobx1\node_modules\mongoose\lib\document.js:594:14)
at model.Document.set (C:\Users\user\mobx1\node_modules\mongoose\lib\document.js:554:24)
at model.Document (C:\Users\user\mobx1\node_modules\mongoose\lib\document.js:73:12)
at model.Model (C:\Users\user\mobx1\node_modules\mongoose\lib\model.js:47:12)
at new model (C:\Users\user\mobx1\node_modules\mongoose\lib\model.js:3698:13)
at C:/Users/user/mobx1/server/routes/todos.js:22:19
at new Promise ()
at addTodos (C:/Users/user/mobx1/server/routes/todos.js:17:8)
at dispatch (C:\Users\user\mobx1\node_modules\koa-router\node_modules\koa-compose\index.js:44:32)
at next (C:\Users\user\mobx1\node_modules\koa-router\node_modules\koa-compose\index.js:45:18)
at C:\Users\user\mobx1\node_modules\koa-router\lib\router.js:346:16
at dispatch (C:\Users\user\mobx1\node_modules\koa-router\node_modules\koa-compose\index.js:44:32)
at C:\Users\user\mobx1\node_modules\koa-router\node_modules\koa-compose\index.js:36:12
(NOTE: i registered and logged in first)
console message (from the code below) shows ctx.account.id is undefined and account.token is ok.
`export async function login(ctx) {
const { username, password } = ctx.request.fields
const account = await Account.findOne({
username,
password: sha512(password, { salt: username })
})
if (!account) throw new Exception('Wrong credentials')
account.token = createAuthToken(account._id)
await account.save()
ctx.cookies.set('token', account.token)
ctx.body = account.toJSON()
console.info('Logged-in context '+ ctx.account.id + ' ' + account.token)
}`
``
The text was updated successfully, but these errors were encountered: