Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

[Bug] When the deletePassword method is called in the onModuleDestroy method, the electron closes with an unhandled exception. #410

Open
2 of 6 tasks
Nikolay-Uvarov opened this issue Aug 24, 2021 · 0 comments

Comments

@Nikolay-Uvarov
Copy link

Prerequisites

Description

We use electron and keytar in the node.js project. We start our application and then we close it by calling method

import { app } from 'electron';
....
app.quit();

The credentials are created by:

await setPassword(config.name, accountName, password);

The credentials are deleted in the onModuleDestroy method after app.quit():

public async onModuleDestroy(): Promise<void> {
    const deletePasswordSet = this.accounts.map((account) => {
        try {
            return deletePassword(config.name, account);
        } catch (error) {
            this.logger.error(error, error.stack, this.context); // this line of code is not called.
        }
    });
    await Promise.all(deletePasswordSet);
}

And we got this after closing the application:
MicrosoftTeams-image

Sometimes we got the following:
MicrosoftTeams-image (1)

Steps to Reproduce

  1. Create the electron application.
  2. Create credentials in the Credential Manager via keytar.
  3. Close the electron application.
  4. Delete the credentials from the Credential Manager via keytar.

Expected behavior:

The application closes correctly.

Actual behavior:

The application closes with an unhandled error.

Reproduces how often:

This problem is reproducible on only one machine.

Versions

"keytar": "7.7.0",
"electron": 12.0

Additional Information

Windows 10 (20H2 #19042.867)

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

No branches or pull requests

1 participant