KindOfGuy
KindOfGuy

Reputation: 3211

Meteor 1.3 update migration

I'm just working through the update to 1.3 and not sure how to handle this error. I'm thinking it might have to do with file load order changing in 1.3. Any ideas? Thanks!

W20160407-09:54:43.528(1)? (STDERR) /Users/technical/.meteor/packages/meteor-tool/.1.3.1.10rlef4++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:267
W20160407-09:54:43.528(1)? (STDERR)                         throw(ex);
W20160407-09:54:43.528(1)? (STDERR)                               ^
W20160407-09:54:43.553(1)? (STDERR) TypeError: Cannot read property 'path' of undefined
W20160407-09:54:43.553(1)? (STDERR)     at Routing (packages/lookback:emails/lib/routing.js:17:9)
W20160407-09:54:43.554(1)? (STDERR)     at packages/lookback:emails/lib/mailer.js:279:11
W20160407-09:54:43.554(1)? (STDERR)     at Array.forEach (native)
W20160407-09:54:43.554(1)? (STDERR)     at packages/lookback:emails/lib/mailer.js:278:28
W20160407-09:54:43.554(1)? (STDERR)     at Function._.each._.forEach (packages/underscore.js:147:22)
W20160407-09:54:43.554(1)? (STDERR)     at Object.init (packages/lookback:emails/lib/mailer.js:274:9)
W20160407-09:54:43.554(1)? (STDERR)     at Object.Mailer.init (packages/lookback:emails/lib/mailer.js:303:7)
W20160407-09:54:43.554(1)? (STDERR)     at app/server/lib/config/config.js:72:8
W20160407-09:54:43.554(1)? (STDERR)     at /Users/technical/code/mssc1.3/.meteor/local/build/programs/server/boot.js:290:5

server/lib/config/config.js

Meteor.startup(function() {

this.Templates = {}
Templates.remindEventEmail = {
    path: 'remindEventEmail.html'
};

Mailer.init({
    templates: Templates
    });

});

private/remindEventEmail.html

<p>Email code<p>

Upvotes: 0

Views: 105

Answers (1)

Leif Shackelford
Leif Shackelford

Reputation: 11

it's not a 1.3 thing, it's a lookback > 0.7.0 thing

if you don't need email previews, simply setting

Mailer.config({
  addRoutes: false
});

may fix your problem.

otherwise follow along for how I use it with Flow Router

according to:

you now need to supply a route field on your template object

https://github.com/lookback/meteor-emails#version-history

route: {
path: '/sample/:name',
// params is an object, with potentially named parameters, and a `query` property
// for a potential query string.
data: function(params) {
  // `this` is the HTTP response object.
  return {
    name: params.name // instead of this.params.name
  };
}
}

so your

Templates.remindEventEmail = {
    path: 'remindEventEmail.html'
};

should become

Templates.remindEventEmail = {
  path: 'remindEventEmail.html'
  route: {
    path: '/event/:_id/remind',
    data: function(params) {
      return {
        event: Events.findOne(params._id);
      }
    }
  }
};

the actual route would then be /emails/event/:_id/remind

please notice the data pattern, you might use another style of query or nesting of the main data context

Upvotes: 1

Related Questions