chikara
September 18, 2015, 1:04am
1
Any insights appreciate into challenges I am having using the Meteorhacks:SSR package, package is defined in my package.js
api.use([
‘accounts-password’,
‘email’,
‘meteorhacks:ssr’,
], ‘server’) ;
When I use SSR server side (server/sendemail.js) as below
SSR.compileTemplate( ‘htmlEmail’, Assets.getText(‘private/passwordResetPlainText.html’));
I get the below error
Exception while invoking method ‘sendEmail’ TypeError: Object # Object> has no method ‘compileTemplate’
sashko
September 18, 2015, 1:09am
2
When you added the file to your package, did you specify that it is server-only?
chikara
September 18, 2015, 1:11am
3
chikara:
api.use([ ‘accounts-password’, ‘email’, ‘meteorhacks:ssr’, ], ‘server’) ;
I did…
api.use([
‘accounts-password’,
‘email’,
'meteorhacks:ssr’,
], ‘server ’) ;
Thanks!
sashko
September 18, 2015, 1:12am
4
Right, I’m talking about when you added server/sendemail.js
with api.addFiles
.
chikara
September 18, 2015, 1:16am
5
I did…
api.addFiles([
‘server/Accounts.validateLoginAttempts.js’,
‘server/startup.js’,
‘server/email/sendEmail.js ’,
], ‘server ’);
chikara
September 18, 2015, 1:19am
7
Yeah me too, thanks anyways!
Is SSR
defined on the server?
You can start a meteor shell
and type SSR
to check.
If not, try using api.imply('meteorhacks:ssr');
in your package.js
to ensure its exports are available to your app.
chikara
September 18, 2015, 4:29pm
9
SSR is definitely defined on Server. When I get all methods on the SSR I get only the
objectconsole.log(EmailGenerator.getAllMethods(SSR));
Here is my output
[ ‘render’ ]
For some reasons it only finds the render method and not the compilTemplate method. I am using SSR in a login “private” package which is used by main app.
https://github.com/meteorhacks/meteor-ssr/blob/master/lib/api.js
nixoz
September 30, 2015, 1:57pm
10
Looks like the package is resolved to an old version. Can you check your .meteor/versions
file, which version is resolved for meteorhacks:ssr
? if you will see something like meteorhacks:ssr@1.0.0
, just change the line to meteorhacks:ssr@2.1.1
after that everything will be smooth… Give me know, cheers.
3 Likes
well done it solves the issue
just use meteorhacks:ssr@2.1.1
and It will work