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

Dependency manager can't resolve Didrepository / AgentConfig #1674

Open
Sshovon opened this issue Dec 19, 2023 · 1 comment
Open

Dependency manager can't resolve Didrepository / AgentConfig #1674

Sshovon opened this issue Dec 19, 2023 · 1 comment

Comments

@Sshovon
Copy link

Sshovon commented Dec 19, 2023

I am trying to integrate a custom did method, but the dependency manager is encountering issues while resolving AgentConfig and DidRepository.

export class CustomModule implements Module {
    public constructor() {}
    public register(dependencyManager: DependencyManager) {
        dependencyManager.resolve(AgentConfig)
    }
    public async initialize(agentContext: AgentContext): Promise<void> { }
}

When I include the CustomModule in the agent modules, the dependency manager struggles to resolve AgentConfig. I attempted to manually register AgentConfig at runtime using dependencyManager.registerInstance, but it didn't resolve the issue.
image
If I include the CustomModule in the agent module, the agent encounters an error during startup.

Screenshot from 2023-12-18 15-47-40
If I omit the CustomModule, the agent starts successfully and creates a DID, but it encounters a failure while attempting to store the DID in the wallet. The issue seems to be related to resolving the DidRepository in the DID registrar, resulting in an error similar to the one seen in the last screenshot, but this time for the DidRepository instead of the agent configuration.

const didRepository = agentContext.dependencyManager.resolve(DidRepository)
await didRepository.save(agentContext, didRecord)

Possibly, the issue might be related to the runtime dependency injection.

@TimoGlastra
Copy link
Contributor

As discussed during Aries WG call:

  • You can probably omit the custom module, and just implement the DidResolver and DidRegistrar methods
  • Usually these types of errors are thrown when your are mixing up AFJ versions (look at yarn.lock / package-lock.json)
  • please provide a minimal reproducable example that shows the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants