目前遇到一个非常令人沮丧的问题。
我可以进行 Meteor.http.get 调用,但是当我把它放在一个循环中时,就会发生不好的事情。
我不是 100% 确定我在做什么,所以任何指针都会很棒!
此代码有效 - 它是咖啡脚本
Meteor.http.get("http://some_site.com/feed.rss", (error, results)->
console.log "results: " + results.statusCode
if results.statusCode is 200
console.log results.content
)
此代码崩溃:
things.forEach( (thing) ->
console.log thing.url # it logs http://some_site.com/feed.rss
Meteor.http.get(thing.url, (error, results) ->
if results.statusCode is 200
console.log results.content
)
))
出现此错误:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property '_meteor_dynamics' of undefined
at Object.bindEnvironment (app/packages/meteor/dynamics_nodejs.js:48:44)
at Object.call (app/packages/http/httpcall_server.js:72:25)
at Object.get (app/packages/http/httpcall_common.js:40:29)
at app/craftcandy.coffee.js:112:28
at app/packages/mongo-livedata/mongo_driver.js:307:7
at /usr/local/meteor/lib/node_modules/mongodb/lib/mongodb/cursor.js:173:11
at [object Object].nextObject (/usr/local/meteor/lib/node_modules/mongodb/lib/mongodb/cursor.js:485:5)
at Object.callback (/usr/local/meteor/lib/node_modules/mongodb/lib/mongodb/cursor.js:478:12)
at Array.0 (/usr/local/meteor/lib/node_modules/mongodb/lib/mongodb/connection/server.js:197:36)
at EventEmitter._tickCallback (node.js:192:41)
退出并显示代码:1 您的应用程序正在崩溃。等待文件更改。