Closed galonsky closed 13 years ago
Switch to the "production" database on iris couch. The article is out of spec, but it should have an array for the "urls" key.
Dean Chen
Duke University | Trinity '12 Computer Science, Economics | Philosophy dean.chen@duke.edu (c) 203.843.8114
On Fri, Aug 5, 2011 at 1:29 AM, galonsky < reply@reply.github.com>wrote:
ERROR: TypeError: Jade:7 5| tr 6| td > 7| a(href='article/' + doc.urls[doc.urls.length - 1] + '/edit') #{doc.title} 8| 9| a(href='article/' + doc.urls[doc.urls.length - 1] + '#disqus_thread', data-disqus-identifier=doc.id) - 10| - if (doc.section) Cannot read property 'urls' of undefined at Object.(eval at (/Users/Alex/Dropbox/website/node_modules/jade/lib/jade.js:226:10)) at Object.anonymous (eval at (/Users/Alex/Dropbox/website/node_modules/jade/lib/jade.js:226:10)) at ServerResponse._render (/Users/Alex/Dropbox/website/node_modules/express/lib/view.js:425:21) at ServerResponse.render (/Users/Alex/Dropbox/website/node_modules/express/lib/view.js:316:17) at /Users/Alex/Dropbox/website/thechronicle_modules/api/lib/site.js:61:12 at /Users/Alex/Dropbox/website/thechronicle_modules/api/lib/api.js:168:9 at IncomingMessage. (/Users/Alex/Dropbox/website/node_modules/cradle/lib/cradle.js:214:72) at IncomingMessage.emit (events.js:81:20) at HTTPParser.onMessageComplete (http.js:133:23) at Socket.ondata (http.js:1228:22) Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63
how do we stop this from happening every time we change the spec of our database documents? reset the db? add checking fields to catch errors for backwards compatibility? If we change the parameters a function expects to retrieve from the db, but don't update the db documents so they all have the field needed, we should include checks so things don't fail.
see my latest commit f7277ee93051f3a0f77a for an example. we need to incorporate suspicious / defensive programming before we pass data to the jade engine so that jade won't crash on a null because it will never, ever receive a null. -- Becuase we check for null before we send data to it. We could presumably do these checks in jade, but from my experience coding logic into jade scripts isn't easy or as straightforward as doing it in the js that sends data to the jade views.
Not working on production db for me either. And 'urls' isn't the problem - 'doc' is undefined.
fixed in 90aa9a6391f73800527f
Just to clarify by production database I meant setting export COUCHDB_DATABASE=production while leaving iriscouch url intact.
That didn't solve the problem thought dean. it was an issue with the code.
That's weird, are you talking about this page? http://localhost:4000/admin/manage
No, we were talking about /article-list . That's what was broken. I fixed it yesterday though.
On Sat, Aug 6, 2011 at 2:54 PM, deanchen < reply@reply.github.com>wrote:
That's weird, are you talking about this page? http://localhost:4000/admin/manage
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1746521
Joe Levy Duke University, Computer Science 919.886.6563 jal50@duke.edu
Oh... my bad. I've been using /admin/manage. I would use that from now on, article-list will probably be deprecated as soon as I get the comments sorted out.
Dean Chen
Duke University | Trinity '12 Computer Science, Economics | Philosophy dean.chen@duke.edu (c) 203.843.8114
On Sat, Aug 6, 2011 at 6:00 PM, jodoglevy < reply@reply.github.com>wrote:
No, we were talking about /article-list . That's what was broken. I fixed it yesterday though.
On Sat, Aug 6, 2011 at 2:54 PM, deanchen < reply@reply.github.com>wrote:
That's weird, are you talking about this page? http://localhost:4000/admin/manage
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1746521
Joe Levy Duke University, Computer Science 919.886.6563 jal50@duke.edu
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1746548
admin/manage lists articles as well?
On Sat, Aug 6, 2011 at 3:15 PM, deanchen < reply@reply.github.com>wrote:
Oh... my bad. I've been using /admin/manage. I would use that from now on, article-list will probably be deprecated as soon as I get the comments sorted out.
Dean Chen
Duke University | Trinity '12 Computer Science, Economics | Philosophy dean.chen@duke.edu (c) 203.843.8114
On Sat, Aug 6, 2011 at 6:00 PM, jodoglevy < reply@reply.github.com>wrote:
No, we were talking about /article-list . That's what was broken. I fixed it yesterday though.
On Sat, Aug 6, 2011 at 2:54 PM, deanchen < reply@reply.github.com>wrote:
That's weird, are you talking about this page? http://localhost:4000/admin/manage
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1746521
Joe Levy Duke University, Computer Science 919.886.6563 jal50@duke.edu
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1746548
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1746590
Joe Levy Duke University, Computer Science 919.886.6563 jal50@duke.edu
Yup
On Aug 6, 2011, at 3:49 PM, jodoglevy reply@reply.github.com wrote:
admin/manage lists articles as well?
On Sat, Aug 6, 2011 at 3:15 PM, deanchen < reply@reply.github.com>wrote:
Oh... my bad. I've been using /admin/manage. I would use that from now on, article-list will probably be deprecated as soon as I get the comments sorted out.
Dean Chen
Duke University | Trinity '12 Computer Science, Economics | Philosophy dean.chen@duke.edu (c) 203.843.8114
On Sat, Aug 6, 2011 at 6:00 PM, jodoglevy < reply@reply.github.com>wrote:
No, we were talking about /article-list . That's what was broken. I fixed it yesterday though.
On Sat, Aug 6, 2011 at 2:54 PM, deanchen < reply@reply.github.com>wrote:
That's weird, are you talking about this page? http://localhost:4000/admin/manage
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1746521
Joe Levy Duke University, Computer Science 919.886.6563 jal50@duke.edu
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1746548
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1746590
Joe Levy Duke University, Computer Science 919.886.6563 jal50@duke.edu
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1746687
that page errors for me if i click on any of the big links (ex: blogs) and shows no articles currently..
this is what i get if i click on blogs or something:
/var/www/chronicle/website/thechronicle_modules/api/lib/api.js:188
callback(null, results.map(function(result) {
^
TypeError: Cannot call method 'map' of undefined
at /var/www/chronicle/website/thechronicle_modules/api/lib/api.js:188:32
at IncomingMessage.
Which database are you using?
On Aug 6, 2011, at 10:36 PM, jodoglevy wrote:
method
tried the production and chronicle
On Sat, Aug 6, 2011 at 7:38 PM, deanchen < reply@reply.github.com>wrote:
Which database are you using?
On Aug 6, 2011, at 10:36 PM, jodoglevy wrote:
method
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1747199
Joe Levy Duke University, Computer Science 919.886.6563 jal50@duke.edu
so i can't even load the page /admin/manage . it goes straight to the error page with the console outputiing the error above.
in
api.docsByDate = function(callback) { db.view("articles/all_by_date", {descending: true}, function(err, results) { if (err) callback(err);
// return only the array of the result values
callback(null, results.map(function(result) {
return result;
}));
});
}
results is null for some reason? also, shouldn't it be _.map not results.map? or is this different from the underscore.js map function?
By the way, can we use databases like we use branches? Have one db for development (like master) that doesn't get changes until they've been smoke tested (and in git master)
Can replicate the master db to an individual testing db for testing in your own branch. Or is that too much?
On Aug 6, 2011, at 7:38 PM, jodoglevy reply@reply.github.com wrote:
tried the production and chronicle
On Sat, Aug 6, 2011 at 7:38 PM, deanchen < reply@reply.github.com>wrote:
Which database are you using?
On Aug 6, 2011, at 10:36 PM, jodoglevy wrote:
method
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1747199
Joe Levy Duke University, Computer Science 919.886.6563 jal50@duke.edu
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1747200
Definitely possible to branch with replication, merging is a whole different story though...
Dean Chen
Duke University | Trinity '12 Computer Science, Economics | Philosophy dean.chen@duke.edu (c) 203.843.8114
On Sun, Aug 7, 2011 at 12:12 AM, galonsky < reply@reply.github.com>wrote:
By the way, can we use databases like we use branches? Have one db for development (like master) that doesn't get changes until they've been smoke tested (and in git master)
Can replicate the master db to an individual testing db for testing in your own branch. Or is that too much?
On Aug 6, 2011, at 7:38 PM, jodoglevy reply@reply.github.com wrote:
tried the production and chronicle
On Sat, Aug 6, 2011 at 7:38 PM, deanchen < reply@reply.github.com>wrote:
Which database are you using?
On Aug 6, 2011, at 10:36 PM, jodoglevy wrote:
method
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1747199
Joe Levy Duke University, Computer Science 919.886.6563 jal50@duke.edu
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1747200
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1747399
Would need to implement some type of patch system for that.
Dean Chen
Duke University | Trinity '12 Computer Science, Economics | Philosophy dean.chen@duke.edu (c) 203.843.8114
On Sun, Aug 7, 2011 at 12:12 AM, Dean Chen dean.chen@duke.edu wrote:
Definitely possible to branch with replication, merging is a whole different story though...
Dean Chen
Duke University | Trinity '12 Computer Science, Economics | Philosophy dean.chen@duke.edu (c) 203.843.8114
On Sun, Aug 7, 2011 at 12:12 AM, galonsky < reply@reply.github.com>wrote:
By the way, can we use databases like we use branches? Have one db for development (like master) that doesn't get changes until they've been smoke tested (and in git master)
Can replicate the master db to an individual testing db for testing in your own branch. Or is that too much?
On Aug 6, 2011, at 7:38 PM, jodoglevy reply@reply.github.com wrote:
tried the production and chronicle
On Sat, Aug 6, 2011 at 7:38 PM, deanchen < reply@reply.github.com>wrote:
Which database are you using?
On Aug 6, 2011, at 10:36 PM, jodoglevy wrote:
method
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1747199
Joe Levy Duke University, Computer Science 919.886.6563 jal50@duke.edu
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1747200
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1747399
Not too sure why that's happening.
Make sure you have the latest changes. *.map is a ecmascript5 thing. I've tested it on both the production and chronicle db. CouchDB should not be returning null for results unless there is error.
On Aug 6, 2011, at 11:15 PM, jodoglevy wrote:
so i can't even load the page /admin/manage . it goes straight to the error page with the console outputiing the error above.
in
api.docsByDate = function(callback) { db.view("articles/all_by_date", {descending: true}, function(err, results) { if (err) callback(err);
// return only the array of the result values callback(null, results.map(function(result) { return result; }));
}); }
results is null for some reason? also, shouldn't it be _.map not results.map? or is this different from the underscore.js map function?
Reply to this email directly or view it on GitHub: https://github.com/thechronicle/website/issues/63#issuecomment-1747273
Its working now...maybe this was becuase my previous database versioning code broke the views.