gpt4 book ai didi

javascript - 从 Node.js 订阅 SalesForce 主题时出错

转载 作者:太空宇宙 更新时间:2023-11-04 01:33:38 26 4
gpt4 key购买 nike

我正在尝试使用 the documentation of JSForce 中提供的代码从 Node.js 服务器订阅 SalesForce 主题。 :

conn.streaming.topic("InvoiceStatementUpdates").subscribe(function(message) {
console.log('Event Type : ' + message.event.type);
console.log('Event Created : ' + message.event.createdDate);
console.log('Object Id : ' + message.sobject.Id);
});

但是,我收到错误位置未定义

[1552904103100] ERROR (13143 on myuser): location is not defined
ReferenceError: location is not defined
at Object.parse (/home/myuser/projects/my-project/node_modules/faye/src/util/uri.js:36:36)
at klass.initialize (/home/myuser/projects/my-project/node_modules/faye/src/protocol/dispatcher.js:21:28)
at klass (/home/myuser/projects/my-project/node_modules/faye/src/util/class.js:13:28)
at Function.Dispatcher.create (/home/myuser/projects/my-project/node_modules/faye/src/protocol/dispatcher.js:179:10)
at klass.initialize (/home/myuser/projects/my-project/node_modules/faye/src/protocol/client.js:44:35)
at klass (/home/myuser/projects/my-project/node_modules/faye/src/util/class.js:13:28)
at Streaming._createClient (/home/myuser/projects/my-project/node_modules/jsforce/lib/api/streaming.js:127:20)
at Streaming._getFayeClient (/home/myuser/projects/my-project/node_modules/jsforce/lib/api/streaming.js:148:42)
at Streaming.subscribe (/home/myuser/projects/my-project/node_modules/jsforce/lib/api/streaming.js:185:25)
at Topic.subscribe (/home/myuser/projects/my-project/node_modules/jsforce/lib/api/streaming.js:41:26)

深入研究我发现的问题a comment in Github指出faye,它是 JSForce 的直接依赖项,只能在浏览器应用程序中使用。然而,JSForce 预计可以在客户端和服务器端工作。

任何关于为什么会发生这种情况的想法将不胜感激。谢谢!

最佳答案

我终于解决了在尝试streaming功能之前进行显式login()调用的问题。

关于javascript - 从 Node.js 订阅 SalesForce 主题时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55219681/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com