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

dataStoreDeleteVerifiableCredential will fail when the TypeORM is not using "default" name #649

Closed
rtang03 opened this issue Jul 29, 2021 · 2 comments · Fixed by #652
Closed
Assignees
Labels
bug Something isn't working

Comments

@rtang03
Copy link

rtang03 commented Jul 29, 2021

When the TypeORM is using connection name, other than "default"; the dataStoreDeleteVerifiableCredential will fail.

See
https://github.com/uport-project/veramo/blob/next/packages/data-store/src/data-store.ts#L71

claims.forEach(async (claim) => {
      await claim.remove()
    })

It will throw below error

(node:65158) UnhandledPromiseRejectionWarning: RepositoryNotFoundError: No repository for "Claim" was found. Looks like this entity is not registered in current "default" connection?

Like previous code snippet, it should use await (await this.dbConnection) to getRepository, to remove corresponding claims.

@rtang03 rtang03 added the bug Something isn't working label Jul 29, 2021
@mirceanis
Copy link
Member

Good catch, are you willing to contribute a fix?

@rtang03
Copy link
Author

rtang03 commented Aug 2, 2021

The fix is easy. But I may not have proper environment to test it well.

Here is fix for your consideration:

    // BEFORE
    // claims.forEach(async (claim) => {
    //   await claim.remove()
    // })

    // AFTER
    await (await this.dbConnection).getRepository(Claim).remove(claims);

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

Successfully merging a pull request may close this issue.

3 participants