Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

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

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

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

dmitris opened this issue Sep 24, 2012 · 6 comments

Comments

@dmitris
Copy link
Contributor

dmitris commented Sep 24, 2012

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
Copy link

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
Copy link
Contributor

isao commented Sep 24, 2012

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

@isao
Copy link
Contributor

isao commented Sep 24, 2012

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

@isao
Copy link
Contributor

isao commented Sep 24, 2012

see also /pull/554

@dmitris
Copy link
Contributor Author

dmitris commented Sep 25, 2012

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
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants