plaid / plaid-node

Node bindings for Plaid
https://plaid.com/docs
MIT License
525 stars 173 forks source link

[Crash] this starting code piece crashes at linkTokenCreate after switching from sandbox to development #551

Closed shawncao closed 2 years ago

shawncao commented 2 years ago

Hi,

Not sure if this piece of code crashes node.js server after I switched secret/environment from sandbox to development, could you help take a look?

version: "plaid":` "^12.0.0",

code

    return new Promise<LinkTokenCreateResponse>((resolve) => {
      this.client
        .linkTokenCreate(req)
        .then((res) => {
          resolve(res.data);
        })
        .catch((e) => {
          LOG.error(`Failed to create link token: ${JSON.stringify(e)}`);
          resolve(null);
        });
    });

error:

[Nest] 24659  - 10/28/2022, 2:30:40 PM     LOG [NestApplication] Nest application successfully started +1ms

/Users/shawncao/columns/src/api/node_modules/plaid/node_modules/axios/lib/core/createError.js:16
  var error = new Error(message);
              ^
Error: Request failed with status code 400
    at createError (/Users/shawncao/columns/src/api/node_modules/plaid/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/Users/shawncao/columns/src/api/node_modules/plaid/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/Users/shawncao/columns/src/api/node_modules/plaid/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (node:events:402:35)
    at IncomingMessage.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

A couple of questions:

  1. plaid dashboard didn't give error details, only claiming this is a bad request - https://dashboard.plaid.com/activity/logs, could you help me understand what's wrong? it works completely fine for SANDBOX
  2. why this code crashes, I thought the error is already caught in my catch statement, could you help me understand how this happens?

Thanks a lot!

phoenixy1 commented 2 years ago
  1. can you provide the details of the error as shown in the plaid dashboard?
  2. can you confirm that you have development access and have unused credentials? if so, when you go to https://dashboard.plaid.com/overview/development you should see something like this: image
shawncao commented 2 years ago

Thanks, @phoenixy1 !

As I said, nothing is useful in the log, probably the REQUEST ID is useful for you to look at internally. Also attached my dev page as well, pretty sure the credential is correct.

Screen Shot 2022-10-28 at 4 29 01 PM Screen Shot 2022-10-28 at 4 28 31 PM

shawncao commented 2 years ago

Forget the crash issue, it's not caused by plaid API. But I need help to figure out why this API call fails at 400, the payload seems to have everything required.

    const req: LinkTokenCreateRequest = {
      user: {
        client_user_id: uid,
      },
      client_name: 'Columns',
      products,  // ['auth', 'transactions', 'identity']
      country_codes, // ['US', 'CA']
      language: 'en',
    };
ToddKerpelman commented 2 years ago

If you switch from sandbox to development but don't change secrets (that is, you're still using your sandbox secret), that'll give you a 400 error. Do you think that might be happening?

shawncao commented 2 years ago

Thanks, @ToddKerpelman - no, I switched both environment and secret.

Screen Shot 2022-10-28 at 10 33 58 PM

Are you able to use the 400 "request ID" to look for internal errors? The dashboard log doesn't have more details to be helpful to understand what went wrong.

phoenixy1 commented 2 years ago

@shawncao there should be an error code right below where it says bad request, what happens if you scroll further? you should also be able to get this error code from the logs (which I believe are output to the terminal when you're running the quickstart)

image
shawncao commented 2 years ago

Hi @phoenixy1

For this case, there are no error details showing, it's not scrolling issue, thanks for checking that though. Again, is it possible for you and the team to check the failed details internally by its request ID, for example: WS6kQyNu28mVpWW

Screen Shot 2022-10-29 at 11 07 45 AM
shawncao commented 2 years ago

Hi @phoenixy1, @ToddKerpelman any other help you could offer, please?

phoenixy1 commented 2 years ago

@shawncao the team that responds to GitHub issues doesn't have access to look up troubleshooting details for specific requests. If you'd like Plaid to look into the details of what happened with your request, please submit a support ticket via the Dashboard, and the support team can investigate.

shawncao commented 2 years ago

Sounds good, I'll do that.

shawncao commented 2 years ago

Thanks for all the help! I have already got help from dashboard/ticket support, close this now. Thanks again!