【问题标题】:nextTick error with NodeJSNodeJS 的 nextTick 错误
【发布时间】:2012-04-26 18:06:35
【问题描述】:

我正在尝试测试在此 site 中找到的 Yahoo API。但是我可以得到一个“请求令牌”我似乎无法弄清楚如何继续,因为我的应用程序throws process.nextTick 错误

如果可能的话,也可以帮助分享一些关于如何根据上面提供的网站制作请求代码的代码。下面是我的实现:

var request = https.request({
    host: "api.login.yahoo.com",
    port: 443,
    method: "GET",
    path: "/oauth/v2/get_token?"
        + "&oauth_consumer_key=abc123--"
        + "&oauth_signature_method=PLAINTEXT"
        + "&oauth_nonce=123456"
        + "&oauth_timestamp=1204762971"
        + "&oauth_signature=abc12345%26"
        + "&oauth_version=1.0"
        + "&oauth_token=" + requestToken
}, function(res){
    res.on('data', function(chunk){
        util.log('OAUTH CREDENTIALS: ' + chunk);
    })
});

错误:

Error: socket hang up
at EventEmitter._tickCallback (node.js:192:40)

【问题讨论】:

  • nextTick 错误到底是什么意思?
  • 抛出的实际错误是什么?
  • 您应该添加request.on('error', function(err){ console.log(err); /* handle error better */});。否则错误会传播到process.on('uncaughtException', function(err) {/* handle error better */});,如果不在那里处理会导致进程退出。

标签: javascript node.js yahoo-api


【解决方案1】:

问题是API没有被激活来访问任何雅虎服务,我从站点API管理中激活了一个,现在它可以工作了,多么愚蠢。

【讨论】:

    猜你喜欢
    • 2016-11-03
    • 2021-12-30
    • 1970-01-01
    • 2023-03-19
    • 2020-03-01
    • 2019-01-10
    相关资源
    最近更新 更多