lookback / meteor-emails

Improved Meteor emails with templating, previews and automated CSS/SCSS inlining.

Home Page:https://atmospherejs.com/lookback/emails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Template file could not be read on modulus

vjain20 opened this issue · comments

Hi,

I am using lookback:meteor-emails package and it works fine on my laptop, but it throws an error when I try to deploy my project to modulus.io. In the Template , i just use the name of the file as path (welcome.html). But I am always getting a "Could not read template file" error . Following is the log:

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/programs/server/assets/app/welcome.html mailer
Inside create user
email addreess = vaibhav.jain197@gmail.com
Sending Welcome Email
Could not render email before sending: Can't render undefined mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: private/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: welcome.html mailer

Hm, I wonder if this is related to XervoIO/docker-build-meteor#14 and thus fixed by #61.

Are you able to try the solution in #61 ?

@johanbrook - Thanks for responding.
I tried setting APP_DIR /mnt/app/bundle. However, the error still persists. It seems like multiple paths
were tried but none of them is working.
I am pasting the log below:


Now using node v0.10.41 (npm v3.8.6)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Now using node v0.10.41 (npm v3.8.6)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Inside create user
Now using node v0.10.41 (npm v3.8.6)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: welcome.html mailer
Inside create user
email addreess = vaibhav.jain197@gmail.com
Sending Welcome Email
Could not render email before sending: Can't render undefined mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/appwelcome.html mailer
Inside create user
email addreess = vaibhav.jain197@gmail.com
Sending Welcome Email
Could not render email before sending: Can't render undefined mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/private/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/techshare/private/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/bundle/private/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/bundle/programs/private/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/bundle/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/bundle/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/programs/server/assets/app/welcome.html mailer
Inside create user
email addreess = vaibhav.jain197@gmail.com
Sending Welcome Email
Could not render email before sending: Can't render undefined mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/bundle/programs/server/assets/app/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/bundle/programs/server/assets/app/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/bundle/programs/server/assets/app/private/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/programs/server/assets/app/private/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/programs/server/assets/app/private/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: /mnt/app/programs/server/assets/app/welcome.html mailer
Inside create user
email addreess = vaibhav.jain197@gmail.com
Sending Welcome Email
Could not render email before sending: Can't render undefined mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: private/welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: welcome.html mailer
Now using node v0.10.41 (npm v3.8.7)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main

Could not read template file: welcome.html mailer


Hm, I see two different logs here:

Could not read template file: /mnt/app/programs/server/assets/app/welcome.html

and

Could not read template file: welcome.html

That's kinda weird. There's always the full path that's being logged when there's an error. Did you set the APP_DIR correctly?

In Mailer.js, I see the following:

Utils.Logger.error(Could not read template file: ${template.path}, TAG);

Looks like this should log only 'template.path' which is just the file name.
I have set the APP_DIR to /mail/app/bundle
By default it is /mail/app. Not sure if I did it right.

On Mon, Apr 25, 2016 at 2:25 AM, Johan Brook notifications@github.com
wrote:

Hm, I see two different logs here:

Could not read template file: /mnt/app/programs/server/assets/app/welcome.html

and

Could not read template file: welcome.html

That's kinda weird. There's always the full path that's being logged when
there's an error. Did you set the APP_DIR correctly?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#62 (comment)

Thanks
Vaibhav Jain

Update: The previous log that I posted was not correct. I re-dployed and restarted the app.
This is the log that I get now:


Now using node v0.10.41 (npm v3.8.6)
Found package.json: ./bundle/programs/server/package.json
Running command: npm start

> meteor-dev-bundle@0.0.0 start /mnt/app/bundle/programs/server
> node ../../main
Could not read template file: welcome.html mailer

I tried changing APP_DIR to /mnt/app/bundle in code by setting process.env.APP_DIR just before
Mailer.init. But that did't help and I get the same log as above.


 process.env.APP_DIR = '/mnt/app/bundle';
 Mailer.init({
        templates: Templates,     // Global Templates namespace, see lib/templates.js.
        helpers: TemplateHelpers, // Global template helper namespace.
        layout: {
            name: 'emailLayout',
            path: 'layout.html'  // Relative to 'private' dir.
        }
    });



I don't know if our issue is related, but we are seeing a similar error, but with a deploy to Meteor's Galaxy servers. One interesting thing we saw was that if we changed the name of the missing template file, the error switched to a different template file in our /private directory. This tells me it is something related to the load order of our templates, but I am struggling to identify the issue.

@vjain20 I was able to figure out the root cause of our issue...we had two email templates that had the exact same html contents. When they compiled, meteor got confused as to which template mapped to which html. Not sure if this is your issue as well, but you might want to check that :)