Meteor-Community-Packages / meteor-simple-schema

Meteor integration package for simpl-schema
https://github.com/Meteor-Community-Packages/meteor-simple-schema
MIT License
919 stars 161 forks source link

Match.Where being instantiated as a class, causes error on Meteor 1.6.1 boot #722

Closed jasonschock closed 6 years ago

jasonschock commented 6 years ago

Please see issue meteor/meteor#9383 for context and specific https://github.com/meteor/meteor/issues/9383#issuecomment-345675174.

Basically, this error is now appearing with Meteor 1.6.1 beta on boot:

W20171128-13:29:39.919(-8)? (STDERR) /Users/jschock/.meteor/packages/meteor-tool/.1.6.1-beta.11.js08xa.q30b++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20171128-13:29:39.920(-8)? (STDERR)                        throw(ex);
W20171128-13:29:39.921(-8)? (STDERR)                        ^
W20171128-13:29:39.921(-8)? (STDERR)
W20171128-13:29:39.921(-8)? (STDERR) TypeError: Match.Where is not a constructor
W20171128-13:29:39.922(-8)? (STDERR)     at packages/aldeed_simple-schema.js:1547:26
W20171128-13:29:39.922(-8)? (STDERR)     at packages/aldeed_simple-schema.js:2160:4
W20171128-13:29:39.922(-8)? (STDERR)     at packages/aldeed_simple-schema.js:3128:3
W20171128-13:29:39.922(-8)? (STDERR)     at infos.forEach.info (/Users/jschock/Code/calliope/calliope/.meteor/local/build/programs/server/boot.js:415:13)
W20171128-13:29:39.923(-8)? (STDERR)     at Array.forEach (<anonymous>)
W20171128-13:29:39.924(-8)? (STDERR)     at /Users/jschock/Code/calliope/calliope/.meteor/local/build/programs/server/boot.js:414:9
W20171128-13:29:39.924(-8)? (STDERR)     at /Users/jschock/Code/calliope/calliope/.meteor/local/build/programs/server/boot.js:468:5
W20171128-13:29:39.924(-8)? (STDERR)     at Function.run (/Users/jschock/Code/calliope/calliope/.meteor/local/build/programs/server/profile.js:510:12)
W20171128-13:29:39.924(-8)? (STDERR)     at /Users/jschock/Code/calliope/calliope/.meteor/local/build/programs/server/boot.js:467:11

Per comments by @abernix:

It seems aldeed:simple-schema could accomplish the same thing by not instantiating a new Match.Where as if it were a class.

benjamn commented 6 years ago

It seems as though switching Match.Where to method shorthand syntax in this commit caused it to no longer be usable as a constructor. Instead, Match.Where should now be called as a function, without new. Invoking it as a constructor was creating an unnecessary object before, so this change would be a good idea even if it wasn't strictly necessary.

skirunman commented 6 years ago

Seeing the same problem with aldeed:simple-schema@1.5.3 running METEOR@1.6.1-beta.18

=> Exited with code: 1
W20171213-11:42:54.253(-8)? (STDERR) /Users/jim/.meteor/packages/meteor-tool/.1.6.1-beta.18.1cdl7le++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20171213-11:42:54.253(-8)? (STDERR)                        throw(ex);
W20171213-11:42:54.253(-8)? (STDERR)                        ^
W20171213-11:42:54.254(-8)? (STDERR) 
W20171213-11:42:54.254(-8)? (STDERR) TypeError: Match.Where is not a constructor
W20171213-11:42:54.254(-8)? (STDERR)     at packages/aldeed_simple-schema.js:1547:26
W20171213-11:42:54.255(-8)? (STDERR)     at packages/aldeed_simple-schema.js:2160:4
W20171213-11:42:54.255(-8)? (STDERR)     at packages/aldeed_simple-schema.js:3128:3
.
.
.

@aldeed Any chance PR #723 gets merged and a new version (1.5.4) published to Atmosphere or should we just fork? There are a number of reasons why we can not upgrade to the NPM package version of simple-schema. And if there was any way to merge in PR #616 that would be even more awesome as this fixes another issue for us and many other users. Thanks!

crapthings commented 6 years ago

upgrade to 1.6.1 beta too, same issue here.

skirunman commented 6 years ago

If you don't want to create your own fork you can install ours as a local package. https://github.com/clozertech/meteor-simple-schema We also merged #616. Works great with Meteor 1.6.1.

aldeed commented 6 years ago

The Meteor SimpleSchema package is no longer maintained other than critical fixes to keep it running with each latest Meteor release. Closing non-critical issues in this repo. Anyone who cares about this may do one or more of the following: