I'm using node backend and am trying to connect to plaid. My code:
var plaid = require('plaid');var clientID = "bla";var secretID = "bla";var publicKey = "bla";var client = new plaid.Client(clientID,secretID,publicKey,plaid.environments.sandbox);
However I am getting this error in my console:
throw new Error('Invalid Plaid environment');^Error: Invalid Plaid environmentat 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)
I have tried using each of these with no luck:
plaid.environments.sandboxplaid.environments.development plaid.environments.tartan
What's going on?
Ref: https://plaid.com/docs/quickstart/#accessing-item-data
UPDATE:I've gotten this code below to work in another part of my app:
var plaidClient = new plaid.Client(clientID, secretID, plaid.environments.tartan);
However I am trying to use client.getTransactions()
and it is required to have var plaidClient = new plaid.Client(clientID, secretID, publicID, plaid.environments.sandbox);
in order for client.getTransactions()
to work.
UPDATE?
Best Answer
For some reason I had the wrong version of plaid installed. I needed to uninstall and reinstall to fix. Works now.
The 'plaid.client is not a constructor' error is a common issue that developers encounter when using the Plaid API. It occurs when the code is trying to instantiate the Plaid client object incorrectly.
One possible reason for this error is that the Plaid client library may not be properly installed or imported into the project. Make sure to follow the installation instructions provided by Plaid and verify that the library is correctly included in your code.
Another reason for this error could be that you are using an outdated version of the Plaid client library. Check the Plaid documentation or their GitHub repository to ensure you are using the latest version.
To fix the 'plaid.client is not a constructor' error, you need to ensure that you are instantiating the Plaid client object correctly. Double-check the syntax and make sure you are using the correct method to create a new instance of the client.