meteor-autoform: Errors with latest versions of autoform + collection2 + simpl-schema
Hi aldeed
First of all, thank you for your contributions : simple-schema, collection2 and autoform are killers
I’ve recently wanted to switch to simpl-schema (npm package) and i’ve encountered some errors. Here is how i reproduce the errors
First, set up the project
meteor create test-autoform --release 1.6.1.1
cd test-autoform
meteor add aldeed:collection2 aldeed:autoform
meteor npm install --save simpl-schema
=>aldeed:autoform@6.3.0 =>aldeed:collection2@3.0.0 =>“simpl-schema”: “^1.5.0”
Add a little bit of code
// main.js
import SimpleSchema from 'simpl-schema'
BookSchema = new SimpleSchema({
title: {type: String}
})
Books = new Mongo.Collection('Books')
Books.attachSchema(BookSchema)
// main.html
{{> quickForm collection="Books" id="insertBookForm" type="insert"}}
and then the errors
Exception in template helper: TypeError: Cannot convert undefined or null to object
at Function.from (native)
at _toConsumableArray (http://localhost:3000/packages/modules.js?hash=fcf2e0056ef926384482b794e8a7fdc3b4e032d1:1114:182)
at SimpleSchema.getAllowedValuesForKey (http://localhost:3000/packages/modules.js?hash=fcf2e0056ef926384482b794e8a7fdc3b4e032d1:1711:24)
at Object.autoFormGetOptionsForField [as _getOptionsForField] (http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:2927:24)
at Object.afQuickFieldsQuickFieldAtts (http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:7357:33)
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3051:16
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1715:16
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3103:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3744:12)
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3102:27
Exception in template helper: TypeError: Cannot read property 'singleType' of undefined
at SimpleSchema.getQuickTypeForKey (http://localhost:3000/packages/modules.js?hash=fcf2e0056ef926384482b794e8a7fdc3b4e032d1:1370:40)
at Object.getInputType (http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:2829:31)
at Object.bsFormGroupSkipLabel (http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:8280:27)
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3051:16
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1715:16
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3103:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3744:12)
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3102:27
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=547cf8e466d1d52603d19bd5f48fb5df184fd237:172:18)
at Template.afFormGroup_bootstrap3.HTML.DIV.HTML.SPAN.class (http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:8236:22)
Exception in template helper: TypeError: Cannot read property 'singleType' of undefined
at SimpleSchema.getQuickTypeForKey (http://localhost:3000/packages/modules.js?hash=fcf2e0056ef926384482b794e8a7fdc3b4e032d1:1370:40)
at Object.getInputType (http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:2829:31)
at Object.getTemplateName (http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:6934:32)
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3051:16
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1715:16
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3103:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3744:12)
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3102:27
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=547cf8e466d1d52603d19bd5f48fb5df184fd237:172:18)
at http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:6906:27
Exception in template helper: TypeError: Cannot read property 'singleType' of undefined
at SimpleSchema.getQuickTypeForKey (http://localhost:3000/packages/modules.js?hash=fcf2e0056ef926384482b794e8a7fdc3b4e032d1:1370:40)
at Object.getInputType (http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:2829:31)
at Object.afFieldInputContext (http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:6978:32)
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3051:16
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1715:16
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3103:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3744:12)
at http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3102:27
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=547cf8e466d1d52603d19bd5f48fb5df184fd237:172:18)
at http://localhost:3000/packages/aldeed_autoform.js?hash=954bc02e0fca04fa83ea45bb5b4206380192fdad:6907:23
thanks in advance
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 10
- Comments: 16 (2 by maintainers)
Hi guys
i’ve found the solution use npm “simpl-schema”: “^1.4.3” instead of 1.5
and make sure you have no meteor-simple-schema deps with others packages (ex meteortoys:allthings)
I’ve opened pull request in simple-schema-js package which hopefully will solve this issue aldeed/simple-schema-js#306
quickform still doesn’t work for me autoform works when it is like that:
@Pierre-Mike, what worked for me was to change to aldeed:autoform@6.3.0, “simpl-schema”: “^1.4.2” make sure simpleschema is not installed and packages like meteortoys:allthings which requires simpleschema is also removed. Also try to run npm install to make sure you have the simpl-schema installed to correct version.