Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'type' of undefined #55

Closed
aaronjudd opened this issue Jan 23, 2014 · 4 comments
Closed

TypeError: Cannot read property 'type' of undefined #55

aaronjudd opened this issue Jan 23, 2014 · 4 comments

Comments

@aaronjudd
Copy link

Getting a new error in 0.2.31

  /lib/node_modules/fibers/future.js:173
            throw(ex);
                 ^
  TypeError: Cannot read property 'type' of undefined
    at packages/simple-schema/simple-schema.js:575
    at Function._.each._.forEach (packages/underscore/underscore.js:82)
    at expandSchema (packages/simple-schema/simple-schema.js:573)
    at packages/simple-schema/simple-schema.js:549
     at Array.forEach (native)
     at Function._.each._.forEach (packages/underscore/underscore.js:79)
     at mergeSchemas (packages/simple-schema/simple-schema.js:542)
     at SimpleSchema (packages/simple-schema/simple-schema.js:39)
     at Meteor.Collection (packages/collection2/collection2.js:45)
     at __coffeescriptShare (packages/reaction-shop/common/collections.coffee:381:15) 

I see it's from a little recent funkiness of mine:

@Orders = new Meteor.Collection "Orders",
  schema = new SimpleSchema([Cart,
    additionalField:
      type: String
      optional: true
    status:
      type: String
  ])

Guess, you might want to catch this error.

@aaronjudd
Copy link
Author

Just for historical lookup, I resolved on my end by fixing the declaration to be

@Orders = new Meteor.Collection("Orders",[Cart,OrderItemsSchema])

OrderItemsSchema = new SimpleSchema
    additionalField:
      type: String
      optional: true
    status:
      type: String

simple-schema is ok with this, and it works.

aaronjudd added a commit to reactioncommerce/reaction that referenced this issue Jan 23, 2014
@aldeed
Copy link
Collaborator

aldeed commented Jan 23, 2014

I added a check to prevent this error, but I can't figure out why it would have happened in the first place. There shouldn't be any difference between the handling of your initial syntax and your fix.

@aaronjudd
Copy link
Author

Not sure, but I was having other issues with the first syntax working (on insert it was only inserting the id), and I prefer the second method anyhow, so it's all good. It's here for posterity.

@aldeed aldeed closed this as completed Jan 23, 2014
@yanndebelgique
Copy link

Had the same error. I had 2 quickforms with the same id. Ounce I solved that issue I was good to go.

EDIT: not the same error but the same TypeError. So for posterity: check if you have 2 Quickforms with same id.

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

No branches or pull requests

3 participants