Skip to content

Conversation

@sampaiodiego
Copy link
Member

Proposed changes

I'm proposing the following changes:

  • support null as options on models (see logs below)
  • do not change options object as they are passed as reference
  • fix cases in Raw Models where it were mixing both fields and projection options, in this case mongodb driver gives preference to the latter, possibly causing issues by not returning desired fields.

Issue(s)

How to test or reproduce

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Hotfix (a major bugfix that has to be merged asap)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Changelog

Further comments

This particular case was forcing options to be null, causing the following error:

I20200722-11:37:06.974(-3)? Exception while invoking method 'login' TypeError: Cannot set property 'fields' of null
I20200722-11:37:06.974(-3)?     at UsersRaw._ensureDefaultFields (app/models/server/raw/BaseRaw.js:8:4)
I20200722-11:37:06.974(-3)?     at UsersRaw.findOne (app/models/server/raw/BaseRaw.js:17:8)
I20200722-11:37:06.974(-3)?     at UsersRaw.findOneByUsername (app/models/server/raw/Users.js:25:15)
I20200722-11:37:06.974(-3)?     at app/authentication/server/lib/restrictLoginAttempts.ts:54:41
I20200722-11:37:06.975(-3)?     at /Users/diegosampaio/.meteor/packages/promise/.0.11.2.1xavwef.9sbp++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40
I20200722-11:37:06.975(-3)?  => awaited here:
I20200722-11:37:06.975(-3)?     at Function.Promise.await (/Users/diegosampaio/.meteor/packages/promise/.0.11.2.1xavwef.9sbp++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/promise_server.js:56:12)
I20200722-11:37:06.975(-3)?     at app/authentication/server/startup/index.js:306:15
I20200722-11:37:06.975(-3)?     at packages/callback-hook/hook.js:131:22
I20200722-11:37:06.975(-3)?     at packages/accounts-base/accounts_server.js:154:15
I20200722-11:37:06.975(-3)?     at Hook.each (packages/callback-hook/hook.js:109:15)
I20200722-11:37:06.975(-3)?     at AccountsServer._validateLogin (packages/accounts-base/accounts_server.js:151:29)
I20200722-11:37:06.975(-3)?     at AccountsServer._attemptLogin (packages/accounts-base/accounts_server.js:340:10)
I20200722-11:37:06.976(-3)?     at MethodInvocation.methods.login (packages/accounts-base/accounts_server.js:522:23)
I20200722-11:37:06.976(-3)?     at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1771:12)
I20200722-11:37:06.976(-3)?     at packages/ddp-server/livedata_server.js:719:19
I20200722-11:37:06.976(-3)?     at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
I20200722-11:37:06.976(-3)?     at packages/ddp-server/livedata_server.js:717:46
I20200722-11:37:06.976(-3)?     at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
I20200722-11:37:06.976(-3)?     at packages/ddp-server/livedata_server.js:715:46
I20200722-11:37:06.976(-3)?     at new Promise (<anonymous>)
I20200722-11:37:06.976(-3)?     at Session.method (packages/ddp-server/livedata_server.js:689:23)
I20200722-11:37:06.976(-3)?     at packages/ddp-server/livedata_server.js:559:43

@sampaiodiego sampaiodiego added this to the 3.5.0 milestone Jul 23, 2020
@sampaiodiego sampaiodiego requested review from ggazzo and rodrigok July 23, 2020 22:01
ggazzo
ggazzo previously approved these changes Jul 23, 2020
@sampaiodiego sampaiodiego merged commit 0b83fab into develop Jul 24, 2020
@sampaiodiego sampaiodiego deleted the fix-defaultFields-null branch July 24, 2020 00:36
@sampaiodiego sampaiodiego mentioned this pull request Jul 28, 2020
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

Successfully merging this pull request may close these issues.

3 participants