Skip to content
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

Bug - test seeding DB fails #2727

Open
TestYouTestUntilTest opened this issue Sep 23, 2024 · 0 comments
Open

Bug - test seeding DB fails #2727

TestYouTestUntilTest opened this issue Sep 23, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@TestYouTestUntilTest
Copy link

TestYouTestUntilTest commented Sep 23, 2024

Description

pnpm run kyb-manual-review-example results in failure.

Seeding database...
PrismaClientKnownRequestError:
Invalid prisma.alert.createMany() invocation:
Foreign key constraint failed on the field: Alert_businessId_fkey (index)
at Rn.handleRequestError (/home/XXXXXXX/ballerine/node_modules/.pnpm/@prisma[email protected][email protected]/node_modules/@prisma/client/runtime/library.js:174:7325)
at Rn.handleAndLogRequestError (/home/XXXXXXX/ballerine/node_modules/.pnpm/@prisma[email protected][email protected]/node_modules/@prisma/client/runtime/library.js:174:6754)
at Rn.request (/home/XXXXXXX/ballerine/node_modules/.pnpm/@prisma[email protected][email protected]/node_modules/@prisma/client/runtime/library.js:174:6344)
at async Promise.all (index 16)
at async seedTransactionsAlerts (/home/XXXXXXX/ballerine/services/workflows-service/scripts/alerts/generate-alerts.ts:2:21212)
at async seed (/home/XXXXXXX/ballerine/services/workflows-service/scripts/seed.ts:2:20323) {
code: 'P2003',
clientVersion: '4.16.2',
meta: { field_name: 'Alert_businessId_fkey (index)' }
}

Expected Behaviour

BackOffice, Collection and Workflows services should start listening

Actual Behaviour

Command Fails

Environment

  • Node 19.x:

Steps to Reproduce

pnpm run kyb-manual-review-example would exit the process with the database updating error

Possible solution

Alert_businessId
So this businessId is not existed at the time of adding that alert!!!!!!

../scripts/seed.ts

  await seedTransactionsAlerts(client, {
    project: project1,
    //businessIds: businessRiskIds,//!!!!!!!!WRONG
    businessIds: businessIds,////CORRECT
    counterpartyIds: ids1
      .map(
        ({ counterpartyOriginatorId, counterpartyBeneficiaryId }) =>
          counterpartyOriginatorId || counterpartyBeneficiaryId,
      )
      .filter(Boolean) as string[],
    agentUserIds: agentUsers.map(({ id }) => id),
  });

businessRiskIds has another ids – they are not existed!!!!!!

@TestYouTestUntilTest TestYouTestUntilTest added the bug Something isn't working label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant