errors in basic_yql example (getting-started-guide/part2) #547

Closed
dmitris opened this Issue Sep 24, 2012 · 6 comments

4 participants

@dmitris

Getting an error in the example in the getting-started-guide part2 - basic_yql.

After "mojito start" and going to http://localhost:8666/flickr or http://localhost:8666/pineapples, getting an error:

MOJITO qeperf: constructing action context
MOJITO mojito-action-context: ActionContext created for "flickr/index"
MOJITO qeperf: action context created, executing action "index"
DEBUG {
"query": {
"count": 0,
"created": "2012-09-24T09:22:11Z",
"lang": "en-US",
"results": null
}
}

/Users/dmitris/dev/hack/mojito/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/models/model.server.js:29
var rawPhotos = rawYqlData.query.results.photo,
^
TypeError: Cannot read property 'photo' of null
at Object. (/Users/dmitris/dev/hack/mojito/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/models/model.server.js:29:57)
at Object. (http://yui.yahooapis.com/3.5.1-2/build/jsonp/jsonp-min.js:7:959)
at http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20flickr.photos.search%20where%20text%3D%22mojito%22%20and%20api_key%3D%229cc79c8bf1942c683b0d4e30b838ee9c%22&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env&callback=YUI.Env.JSONP.yui_3_5_1_2_9_1348478512821_6:1:254
at Function._exec (/Users/dmitris/.nvm/v0.6.21/lib/node_modules/mojito/node_modules/yui/yui-nodejs/yui-nodejs.js:3735:15)
at Request._callback (/Users/dmitris/.nvm/v0.6.21/lib/node_modules/mojito/node_modules/yui/yui-nodejs/yui-nodejs.js:3759:27)
at Request.callback (/Users/dmitris/.nvm/v0.6.21/lib/node_modules/mojito/node_modules/yui/node_modules/request/main.js:119:22)
at Request. (native)
at Request.emit (events.js:70:17)
at Request. (/Users/dmitris/.nvm/v0.6.21/lib/node_modules/mojito/node_modules/yui/node_modules/request/main.js:521:16)
at Request.emit (events.js:67:17)

A teammate was able to replicate the error.

@yukinying
Yahoo Inc. member

I am the teammate who works with Dmitry. It looks like the api_key has already expired (when debug in YQL). Would that be a useful feature if Mojito could tolerant JS error, e.g. having the try catch block in the main function instead of letting arbitrary random error halting the whole server?

@isao

thanks for the heads up. I believe @lzhan fixed this just now with yahoo/mojito#550

@isao

@yukinying I agree, that example code is not production quality code.

@dmitris

The API key works, but the example still does not due to missing file mojits/Flickr/views/bar.hb.html If I add that file, it looks ok - not sure what exactly was supposed to go in that view.

The bar view is called in controller.server.js
https://github.com/yahoo/mojito/blob/develop/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/controller.server.js#L29

         ac.done({images: images}, {view: {name: 'bar'}});
@zhouyaoji

Thanks for filing the issue! I've added the missing 'bar.hb.html' template so that the app works.

@zhouyaoji zhouyaoji closed this Oct 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment