meteorhacks / meteor-ssr

Server Side Rendering for Meteor
https://atmospherejs.com/meteorhacks/ssr
264 stars 29 forks source link

not working with Meteor 1.2.0.2 #35

Open sanidkpc opened 9 years ago

sanidkpc commented 9 years ago

meteor-ssr not working with latest meteor release[v1.2.0.2] Error response: TypeError: Cannot call method 'charAt' of undefined at packages/blaze/packages/blaze.js:1609:1 at packages/meteorhacks_ssr/packages/meteorhacks_ssr.js:49:1 at Object.Blaze._TemplateWith (packages/meteorhacks_ssr/packages/meteorhacks_ssr.js:64:1) at [object Object]._render (packages/meteorhacks_ssr/packages/meteorhacks_ssr.js:153:1) at packages/blaze/packages/blaze.js:557:1 at Object.Blaze._withCurrentView (packages/blaze/packages/blaze.js:670:1) at Object.Blaze._expandView (packages/blaze/packages/blaze.js:556:1) at [object Object].Blaze._HTMLJSExpander.def.visitObject (packages/blaze/packages/blaze.js:581:1) at [object Object].HTML.Visitor.def.visit (packages/htmljs/packages/htmljs.js:91:1) at Object.Blaze._expand (packages/blaze/packages/blaze.js:615:1) at Object.Blaze._expandView (packages/blaze/packages/blaze.js:561:1)

darrynten commented 9 years ago

Fixed in #37

sanidkpc commented 9 years ago

Thanks @darrynten

ryanswapp commented 9 years ago

I'm getting the same error...

Exception while invoking method 'pokemon/generate_pdf' TypeError: Cannot call method 'charAt' of undefined
I20151103-08:43:25.025(-7)?     at packages/blaze/lookup.js:187:1
I20151103-08:43:25.025(-7)?     at packages/meteorhacks_ssr/lib/overrides.js:41:1
I20151103-08:43:25.026(-7)?     at Object.Blaze._TemplateWith (packages/meteorhacks_ssr/lib/overrides.js:56:1)
I20151103-08:43:25.026(-7)?     at [object Object]._render (packages/meteorhacks_ssr/lib/dynamic.js:16:1)
I20151103-08:43:25.026(-7)?     at packages/blaze/view.js:425:1
I20151103-08:43:25.026(-7)?     at Object.Blaze._withCurrentView (packages/blaze/view.js:538:1)
I20151103-08:43:25.026(-7)?     at Object.Blaze._expandView (packages/blaze/view.js:424:1)
I20151103-08:43:25.026(-7)?     at [object Object].Blaze._HTMLJSExpander.def.visitObject (packages/blaze/view.js:449:1)
I20151103-08:43:25.026(-7)?     at [object Object].HTML.Visitor.def.visit (packages/htmljs/visitors.js:61:1)
I20151103-08:43:25.026(-7)?     at Object.Blaze._expand (packages/blaze/view.js:483:1)

I'm running Meteor 1.2.1. Any idea as to what's going on?

Streemo commented 8 years ago

I am also getting this error in 1.2.1. It seems like SSR.render('layout', context) is throwing. It's making it impossible to use the package.

context = {
  main: 'home'
}

has trouble getting the 'home' template.

Streemo commented 8 years ago
//works
{{> home}}
//does not work
//main === 'home'
{{>Template.dynamic template=main}}

Temporary fix:

{{#if atHome}}
  {{>home}}
{{else}}
  ...
{{/if}}
jonnymd commented 8 years ago

@ryanswapp Did you resolve the error? I'm trying to follow a tutorial that you wrote on Nov 3 (same date as your post here)

https://medium.com/@ryanswapp/getting-started-with-meteor-and-react-d411a87a1674#.rv51jica7

and I'm getting this same error...

ryanswapp commented 8 years ago

@jonnymd I did! However, I'm not exactly sure what I did... It's been a little while. Maybe try cloning my repo and seeing if the app in the final directory works for you locally. If so, compare your code and see if there are any differences. Here is the link https://github.com/ryanswapp/meteor-pdf-tutorial

I wish I could remember what I did... Sorry about that

jonnymd commented 8 years ago

Just FYI, I cloned your repo and the final worked locally. Not sure what was different but that seemed to work. Thanks for writing the tutorial.

Also, based on ryanswapps usage of this in his tutorial I believe this issue could be closed (seems resolved).

ryanswapp commented 8 years ago

Good to hear! Glad it's working. Wish I could remember what I did to fix the issue... haha

Alino commented 8 years ago

I think I know how you fixed it. The problem disappeared as soon as I called the dynamic template with data object as well. (in my case I didn't need to pass any data inside template data context so I am passing an empty object)

js

const html = SSR.render("email", {
  template: "emailXmlValidationError",
  data: {}
});

html

{{> Template.dynamic template=template data=data}}