-
Notifications
You must be signed in to change notification settings - Fork 207
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
Credentials Stuck in "Request Sent" State When Issuing Out-of-Band Credentials with New Connections #2159
Comments
Thanks for opening the elaborate issue @sagarkhole4. could you explain a bit more why this fixes the issue? |
Thank you for looking into this! If we look at this code: async withTenantAgent(options, withTenantAgentCallback) {
this.logger.debug(`Getting tenant agent for tenant '${options.tenantId}' in with tenant agent callback`);
const tenantAgent = await this.getTenantAgent(options);
try {
this.logger.debug(`Calling tenant agent callback for tenant '${options.tenantId}'`);
const result = await withTenantAgentCallback(tenantAgent);
return result;
}
catch (error) {
this.logger.error(`Error in tenant agent callback for tenant '${options.tenantId}'`, { error });
throw error;
}
finally {
this.logger.debug(`Ending tenant agent session for tenant '${options.tenantId}'`);
await tenantAgent.endSession();
}
} The issue here is that we are closing the tenant session in the |
Hi @TimoGlastra , Do you suggest that we should update this code. |
Well said, young(er) @TimoGlastra ! At the time this code was originally written, there was no Now that there is a timeout parameter (set by default), it could be safer to await the connection to be completed before returning (as in the code @sagarkhole4 suggested), but I'm not sure if it will work completely for all use cases:
Probably, a practical way of solving this issue without touching anything in Credo's source code would be to put some more logic in your |
When issuing credentials using the out-of-band protocol with connection reuse disabled or when establishing a new connection, the connection gets successfully established, but the credentials remain in the request-sent state indefinitely.
This issue does not occur when reusing an existing connection. In such cases, the credential issuance process transitions to the appropriate final state as expected.
Solution
To resolve the issue, we updated the code in the following file:
File:
/core/build/modules/oob/OutOfBandApi.js
Original Code:
Updated Code:
Why the Change Was Needed
The previous implementation used
.then()
and.catch()
to handle the promise returned byreturnWhenIsConnected
. While functional, it caused issues in managing asynchronous operations and awaiting the completion of the connection process.The updated implementation leverages
**async/await**
within a**try-catch**
block, which provides:The text was updated successfully, but these errors were encountered: