Closed codentacos closed 11 months ago
I took a look into this to see whether it might be simple to use fetch instead of axios but it appears that the node generators are tied to specific http libraries. Generating the library to use fetch instead of axios would require generating an entirely separate library, with a separate set of mustache/configuration files, that would have a different interface and possibly not even the same level of support for OpenAPI (see https://stackoverflow.com/questions/71213188/openapi-generator-typescript-fetch-vs-typescript-node-vs-typescript-axios). Given that, I think this is probably going to have to go in the "won't do" pile unless we see significant increased demand for it.
If you want to try generating your own fetch-supporting library, you can try using a generation tool such as https://github.com/jhannes/openapi-generator-typescript-fetch-api/tree/main or https://openapi-generator.tech/docs/generators/typescript-fetch/ in conjunction with the Plaid OpenAPI spec here: https://github.com/plaid/plaid-openapi
+1 codentacos
I put together a simple fetch-based wrapper in a new library called plaid-fetch (repo here). It's generated using the same OpenAPI generator library as the official plaid-node
, and I tried to keep the config similar to Plaid's own config. Everything should work mostly similar to the official library (with a few differences I've noticed so far noted in the README). Feel free to test and contribute any issues or PRs. I've run some initial queries on the Vercel Edge runtime and things seem to work as expected.
Another approach that could be worth exploring is plugging a fetch adapter for Axios into plaid-node
.
@heysanil thanks, that's great! I'll add that later this month to the community libraries page at https://plaid.com/docs/api/libraries/#community-libraries
Unable to use Plaid Node in an API route using Vercel's edge runtime due to Axios dependency. Axios does not work in Edge runtimes from what I have found here.
My reason for needing the edge runtime is the longer time allowed for returning a response before timeout without paying for the Pro plan on Vercel. When connecting an item and the initial transaction request is done via
transactions/sync
is seems to take longer than the 10 seconds before the vercel serverless function times out.