格子连接到节点错误的客户端

时间:2017-03-22 19:15:17

标签: javascript node.js backend plaid

我正在使用节点后端,我正在尝试连接到格子。 我的代码:

var plaid = require('plaid');

var clientID = "bla";
var secretID = "bla";
var publicKey = "bla";

var client = new plaid.Client(
    clientID,
    secretID,
    publicKey,
    plaid.environments.sandbox

);

但是我在控制台中收到此错误:

    throw new Error('Invalid Plaid environment');
    ^

Error: Invalid Plaid environment
    at new Plaid.Client (C:\Users\me\Documents\found\SPA\node_modules\plaid\index.js:26:11)
    at module.exports (C:\Users\me\Documents\found\SPA\app\routes.js:48:22)
    at Object.<anonymous> (C:\Users\me\Documents\found\SPA\server.js:48:24)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)

我尝试过使用其中每一项都没有运气:

plaid.environments.sandbox
plaid.environments.development 
plaid.environments.tartan

发生了什么事?

参考:https://plaid.com/docs/quickstart/#accessing-item-data

更新: 我已经将下面的代码用于我的应用程序的另一部分:

var plaidClient = new plaid.Client(clientID, secretID, plaid.environments.tartan);

但是我尝试使用client.getTransactions()并且需要var plaidClient = new plaid.Client(clientID, secretID, publicID, plaid.environments.sandbox); 为了让client.getTransactions()起作用。

UPDATE?

1 个答案:

答案 0 :(得分:0)

出于某种原因,我安装了错误的格子版本。我需要卸载并重新安装才能修复。现在工作。