Exception in template helper: Error: SafetyMessages is not in the window scope
at Object.lookup (http://localhost:3000/packages/aldeed_autoform.js?hash=b5d2c19978a500041b09f9df0ab49fd60a0ba883:258:17)
at setDefaults (http://localhost:3000/packages/aldeed_autoform.js?hash=b5d2c19978a500041b09f9df0ab49fd60a0ba883:3151:43)
at Object.AutoForm.parseData (http://localhost:3000/packages/aldeed_autoform.js?hash=b5d2c19978a500041b09f9df0ab49fd60a0ba883:2893:10)
at Object.quickFormContext (http://localhost:3000/packages/aldeed_autoform.js?hash=b5d2c19978a500041b09f9df0ab49fd60a0ba883:6433:35)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3051:16
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1715:16
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3103:66
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3102:27
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:172:18)
meteor.js?hash=cbcc712d51de4298c275e8dcf25c66c29914f19a:992 Exception in defer callback: TypeError: Cannot read property 'id' of null
at Blaze.View.<anonymous> (http://localhost:3000/packages/aldeed_autoform.js?hash=b5d2c19978a500041b09f9df0ab49fd60a0ba883:6288:25)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1934:20
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1932:29
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12)
at viewAutorun (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1931:18)
at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:339:36)
at new Tracker.Computation (http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:229:10)
at Object.Tracker.autorun (http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:613:11)
at Blaze.View.autorun (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1944:22)
safety-messages:1 Failed to decode downloaded fon```
I discovered the same recently when dynamically importing code. Collections no longer get added to the global scope, so when trying to use autoform you need to provide a helper that actually returns the collection.
Here is a template that uses autoform
<template name="App_page_add">
<h1>Add a new {{type}} Page</h1>
{{>quickForm collection=collection doc=page id="insertPageForm" type="insert"}}
</template>
And here is the javascript
import './add.html';
import { Pages } from '/imports/api/pages';
Template.App_page_add.helpers({
page(){
//
// we need to return an object containing type
//
return Template.currentData();
},
collection(){
//
// we need to return the Pages collection
//
return Pages;
},
});