-
Notifications
You must be signed in to change notification settings - Fork 296
Integrate trigger.dev functions for plaid and gocardless #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Integrate trigger.dev functions for plaid and gocardless #297
Conversation
Co-authored-by: christer.hagen <christer.hagen@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Co-authored-by: christer.hagen <christer.hagen@gmail.com>
Co-authored-by: christer.hagen <christer.hagen@gmail.com>
Co-authored-by: christer.hagen <christer.hagen@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Prisma Query Error: Incorrect Relation Field Usage
The Prisma relation field BankConnection is incorrectly used in family.findMany queries. It should be bankConnections (camelCase, plural) to align with Prisma's naming conventions and the actual relation name, otherwise, it will cause runtime errors.
src/trigger/gocardless-tasks.ts#L743-L749
Badget/src/trigger/gocardless-tasks.ts
Lines 743 to 749 in 038590e
| where: { | |
| BankConnection: { | |
| some: { | |
| provider: "GOCARDLESS", | |
| }, | |
| }, | |
| }, |
src/trigger/gocardless-tasks.ts#L793-L800
Badget/src/trigger/gocardless-tasks.ts
Lines 793 to 800 in 038590e
| // Get all families with GoCardless connections | |
| const familiesWithGoCardless = await prisma.family.findMany({ | |
| where: { | |
| BankConnection: { | |
| some: { | |
| provider: "GOCARDLESS", | |
| }, | |
| }, |
Bug: Plaid API Client Environment Hardcoded
The Plaid API client is hardcoded to use PlaidEnvironments.sandbox. This prevents the application from connecting to the live Plaid API in production environments, as it will always connect to the sandbox regardless of the deployment stage. The Plaid environment should be configurable via environment variables.
src/trigger/plaid-tasks.ts#L14-L15
Badget/src/trigger/plaid-tasks.ts
Lines 14 to 15 in 038590e
| const configuration = new Configuration({ | |
| basePath: PlaidEnvironments.sandbox, |
Was this report helpful? Give feedback by reacting with 👍 or 👎
Description
Integrates
trigger.devfor Plaid and GoCardless operations to enable asynchronous processing and scheduled data synchronization. This improves UI responsiveness, reliability with retries, and provides flexible update frequency management for financial data.Fixes # (issue number)
Type of Change
Changes Made
src/trigger/plaid-tasks.tsfor Plaid-relatedtrigger.devtasks (e.g.,exchangePlaidPublicToken,importPlaidTransactions,syncPlaidBalances).src/trigger/gocardless-tasks.tsfor GoCardless-relatedtrigger.devtasks (e.g.,completeGoCardlessConnection,importGoCardlessTransactions,syncGoCardlessBalances).src/trigger/index.tsto export alltrigger.devtasks.TRIGGER_INTEGRATION.mdwith comprehensive documentation on usage, configuration, and integration steps.src/trigger/example.ts.Testing
Please describe the tests that you ran to verify your changes:
Screenshots (if applicable)
Please add screenshots of any UI changes:
Before:
After:
Database Changes
pnpm db:generateandpnpm db:pushto ensure generated client is up-to-date with new imports likePrisma)Checklist
Additional Notes
This PR introduces
trigger.devto handle financial data operations (Plaid and GoCardless) asynchronously and with scheduled tasks. This significantly improves:Next Steps for Reviewer/User:
pnpm db:generateandpnpm db:pushto ensure Prisma client is updated.src/actions/plaid-actions.ts) to use the newtrigger.devtasks as detailed inTRIGGER_INTEGRATION.md.trigger.devfunctions (npx trigger.dev@latest deploy).TRIGGER_INTEGRATION.mdfor detailed usage and configuration.