404 on my Macro in production! Dev works fine

Hi!

ViewsDir is set on app.js, both the macro and the blueprint work great on development mode but it production I get a 500 error for the macro /render.
var viewsDir = __dirname + ‘/views’;

I also verified I have the route and is a GET … it works on dev, but not on prod.

Error: Failed to lookup view "an error has occurred :frowning: " in views directory “/var/app/current/views”

If I go to the /var/app/current/views the render.hbs is there.

I’m deploying my app on AWS ELB and only the macro 404s. The blueprint doesn’t.

Any ideas or tips?

Joao

This is what my index.js looks like:

app.get(’/render’, addon.authenticate(), function(req, res) {

});

Tried to remove addon.authenticate() and still doesn’t work. Error: Http client options must specify clientKey

That’s very strange.

Please try updating dependency libraries, like in atlassian-connect-express-template:
https://bitbucket.org/atlassian/atlassian-connect-express-template/src/master/package.json

And check if the view engine is configured correctly:
https://bitbucket.org/atlassian/atlassian-connect-express-template/src/master/app.js

// Configure Handlebars
const viewsDir = __dirname + '/views';
app.engine('hbs', hbs.express4({partialsDir: viewsDir}));
app.set('view engine', 'hbs');
app.set('views', viewsDir);

Note the call “hbs.express4”. But probably “hbs.express3” is also OK.

I had var viewsDir = __dirname + ‘/views’; instead of const and hbs.express3.

Reviewing my configuration! I think I have a very old ACE app.js. Im going to try to use this one and see how it goes.

Thanks
Joao

Still failed to lookup view! :frowning: What is super annoying is that it works on development mode!.

And I place a console.log on app.js and the viewsDir is correct: VIEWS DIR:/var/app/current/views