Error when visiting tag pages #3

Closed
ndarilek opened this Issue Jan 18, 2014 · 4 comments

Comments

Projects
None yet
4 participants

Hi, new Docpad user here, so please excuse me if I fail to provide relevant information.

Using the latest versions of Docpad and your tags plugin as of this morning. I have a setup like so:

tags:
  extension: ".html.jade"
  injectDocumentHelper: (document) ->
    document.setMeta(
      layout: 'default'
      data: "!=partial('tag')"
    )

I get correctly-formatted tag pages in out/tags/whatever.html.

I'm using cleanurls. If I hit http://localhost:9778/tags/sometag, I get the following error:

TypeError: Cannot read property 'size' of null
at DocPad.serveDocument (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/out/lib/docpad.js:4098:50)
at DocPad.serveDocument (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/out/lib/docpad.js:5:61)
at /home/nolan/Projects/thewordnerd.info/node_modules/docpad/out/lib/docpad.js:4143:23
at DocPad.getFileByRoute (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/out/lib/docpad.js:593:7)
at DocPad.serverMiddlewareRouter (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/out/lib/docpad.js:4133:14)
at Object.handle (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/out/lib/docpad.js:5:61)
at next (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at pass (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/lib/router/index.js:110:24)
at Router._dispatch (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/lib/router/index.js:173:5)
at Object.router (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/lib/router/index.js:33:10)
at next (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at DocPad.serverMiddlewareHeader (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/out/lib/docpad.js:4126:7)
at Object.handle (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/out/lib/docpad.js:5:61)
at next (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Object.handle (/home/nolan/Projects/thewordnerd.info/docpad.coffee:78:20)
at next (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Object.methodOverride as handle
at next (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Object.json as handle
at next (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Object.urlencoded as handle
at next (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Object.expressInit as handle
at next (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Object.query as handle
at next (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/proto.js:193:15)
at Function.app.handle (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/proto.js:201:3)
at app (/home/nolan/Projects/thewordnerd.info/node_modules/docpad/node_modules/express/node_modules/connect/lib/connect.js:65:37)
at EventEmitter.emit (events.js:98:17)
at request (/home/nolan/Projects/thewordnerd.info/node_modules/docpad-plugin-livereload/node_modules/primus/transformer.js:135:36)
at Server.EventEmitter.emit (events.js:98:17)
at HTTPParser.parser.onIncoming (http.js:2108:12)
at HTTPParser.parserOnHeadersComplete as onHeadersComplete
at Socket.socket.ondata (http.js:1966:22)
at TCP.onread (net.js:525:27)

I tried hitting tags/whatever.html since I'm using cleanurls and I wondered if that might be an issue, but no luck. I only see this with tag pages; others on my site seem to generate and render fine.

Thoughts? Please let me know if I can provide more details. I'm new enough at Docpad that I don't quite understand what interacts with what else and how. Thanks!

+1, I have same error

Yes, I have error too

And maybe it not linked, but tags generated only if you run docpad for the first time. When running watch, tags not found.

I'm having this problem too.

This seems to be because of the ETag generation that happens around docpad.js:4098. I'm not sure why the document.getStat() call is failing, because the document certainly exists, and seems to have correct paths when I dump it at that stage.

If I protect the ETag generation with a check on stat && mtime (instead of mtime alone), then at least the error doesn't happen.

@balupton balupton added a commit to docpad/docpad that referenced this issue Jan 27, 2014

@balupton balupton Merge pull request #787 from timaschew/patch-1
add null check for stat docpad/docpad-plugin-tags#3
2ee17b4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment