veliovgroup / jazeee-meteor-spiderable

Fork of Meteor Spiderable with longer timeout, caching, better server handling
https://atmospherejs.com/jazeee/spiderable-longer-timeout
33 stars 9 forks source link

Couldn't find a template #27

Closed dnish closed 8 years ago

dnish commented 8 years ago

Hey guys, I'm getting the following error when I try to call my page with ?_escapedfragment=

Couldn't find a template named "layout" or "layout". Are you sure you defined it?

It works fine without the escaped fragment. Anybody knows what causes this error?

When I deploy my application and I call it with escaped fragment, I only get the default Iron:Router page:

iron:router Organize your Meteor application.

dr-dimitru commented 8 years ago

Hi @dnish , Are you getting this at browser or server? Does you have and/or use template named layout?

dnish commented 8 years ago

@dr-dimitru I'm getting both errors on client side (browser).

dr-dimitru commented 8 years ago

Strange...

Does you have and/or use template named layout?

dnish commented 8 years ago

Yep, it is our default layout. It works everything fine when I'm not using the escapedfragment query. On the "normal" spiderable package, I get a Fibers error. Don't know if it has something to do with the error here?

dr-dimitru commented 8 years ago

@dnish which routing package are you using?

dnish commented 8 years ago

I'm using iron:router martino:iron-router-i18n force-ssl meteorhacks:fast-render

dr-dimitru commented 8 years ago

@dnish could you set Spiderable.debug = true and run application from clean state after meteor reset, and post here full console output?

dnish commented 8 years ago

Okay, I call

http://localhost:3000/de/?_escaped_fragment_=

in my browser, my server logs the following:

=> Meteor server restarted
I20151219-18:58:06.933(1)? Spiderable successfully completed for url: [200] http://localhost:3000/de/

but I get

Couldn't find a template named "layout" or "layout". Are you sure you defined it?

as result in my browser.

If I call http://localhost:3000/de/ directly, everything works fine.

dr-dimitru commented 8 years ago

Hmm... post here all files related to Router And where are you setting: Meteor.isReadyForSpiderable = true ?

dnish commented 8 years ago

I've set isReadyForSpiderable in my onRendered method.

This is my router.js:

Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
notFoundTemplate: 'notFound',

i18n: {

    langCodeForDefaultLanguage: false
}

});

Router.route('/', {
name: 'start',
fastRender: true,
yieldTemplates: {
    'title':{to:'title'}
},

onBeforeAction: function () {
    SEO.set({
        title: TAPi18n.__("title"),
        meta: {
            'description': TAPi18n.__("meta")
        }
    });
    this.next();
}

});

Router.route('/decide', {
name: 'decide',
waitOn: function () {
    return [Meteor.subscribe('onlineUsers', likedUsers.array()), Meteor.subscribe('likes')]
}
});

Router.route('/chat', {
name: 'chat',
template:'chat_new',
waitOn: function () {
    return [Meteor.subscribe('onlineUsers')]
},
onStop: function () {
    try {
        userConnection.close();
        userCall.close();
    } catch (e) {
    }
}
});

var requireLogin = function () {
if (!Meteor.user() || !ownStream) {
    Router.go('start');
} else {
    this.next();
}
}

Router.onBeforeAction(requireLogin, {only: ['decide', 'chat']});
dnish commented 8 years ago

Okay, I've tested it with a blank project and the same packages - one package is causing this error, I'll report back until I've found that one.

dnish commented 8 years ago

@dr-dimitru materialize:materialize is causing this error.

dr-dimitru commented 8 years ago

@dnish try to remove line with isReadyForSpiderable let's see if it helps

dnish commented 8 years ago

@dr-dimitru I didn't use isReadyForSpiderable in the new demo project. If I uncomment the materialize package, everything works fine again. Seems like Materialize is manipulating something that collides with the Spiderable package.

dnish commented 8 years ago

@dr-dimitru Removing it from the packages and adding it via Bower solved the problem on my dev machine, on my production environment I still get the default Iron Router page when I'm calling my site with escaped_fragment.

dr-dimitru commented 8 years ago
  1. What happens if you run meteor via meteor run --production on dev machine?
  2. What the difference between dev and prod machines? OS?
dnish commented 8 years ago

@dr-dimitru If I run it by --production on the dev machine, I get the same error like on my production machine. I'm using MacOS on my dev machine and Ubuntu 14.04 on my production machine.

It display the Iron Router page that you will see if no routes are defined.

dr-dimitru commented 8 years ago

I think I got this. Is routes defined in /lib or /client only?

dnish commented 8 years ago

Routes are defined in /lib/router/router.js

dr-dimitru commented 8 years ago

hmm.. Not wrapped into Meteor.startup()?

dnish commented 8 years ago

Yep, routes aren't wrapped into Meteor.startup().

dr-dimitru commented 8 years ago

Let's try to define them in very top of the code, name file with prepended ___ (three underscored) and place it right in /lib directory

dnish commented 8 years ago

I've to say that this problem only occurs in my current project, not in the new demo project - the demo project has the same router structure. I'll check out which part of my code will cause this error.

dr-dimitru commented 8 years ago

@dnish okay, let me know

dnish commented 8 years ago

@dr-dimitru My "bower" folder was in lib/bower, that caused the error. I've moved it into .meteor/local/bower, now it's working fine, thank you for your help :).

dr-dimitru commented 8 years ago

You are welcome

dr-dimitru commented 8 years ago

@dnish @jazeee looks like this issue is solved. Could we close this one?

dnish commented 8 years ago

@dr-dimitru Yep, we can close it.

ddaydd commented 7 years ago

I have the same problem, and many packages...

did you find why this problem exist?

i don't use materialize:materialize meteor reset done Spiderable.debug = true Spiderable successfully completed for url: [200] http://localhost:3000/

i have removed ian:accounts-ui-bootstrap-3 package, now i have a blank page... like this? https://github.com/prerender/prerender/issues/214

https://forums.meteor.com/t/materialize-breaks-spiderable/7152/8

dr-dimitru commented 7 years ago

Hello @ddaydd

Could you post an error and its stacktrace, also it happens on Server or Client?

Original issue was solved with:

I've moved it into .meteor/local/bower, now it's working fine...

ddaydd commented 7 years ago

I had a package that contained a Class javascript, without having the ecmascript package in dependance, I added ecmascript, everything is good now, thanks