Skip to content

nodeCrypto.randomBytes is not a function #34479

@itsyoboieltr

Description

@itsyoboieltr

Describe the bug

nodeCrypto.randomBytes is not a function

nodeCrypto.randomBytes is not a function
  at async handleCreateNewAccount (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-ui_p.28e2a84c46c80dcaff01.js:32468:39)
  at async handleCreateNewWallet (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-ui_p.28e2a84c46c80dcaff01.js:30741:13)
  at async handleCreatePassword (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-ui_p.28e2a84c46c80dcaff01.js:30826:17) 

The function that is failing:

function createNewVaultAndGetSeedPhrase(password) {
    // TODO: Fix in https://github.com/MetaMask/metamask-extension/issues/31879
    // eslint-disable-next-line @typescript-eslint/no-misused-promises
    return async (dispatch) => {
        dispatch(showLoadingIndication());
        try {
            await createNewVault(password);
            const seedPhrase = await getSeedPhrase(password);
            return seedPhrase;
        } catch (error) {
            dispatch(displayWarning(error));
            if ((0,
            _shared_modules_error__WEBPACK_IMPORTED_MODULE_24__.isErrorWithMessage)(error)) {
                throw new Error((0,
                _shared_modules_error__WEBPACK_IMPORTED_MODULE_24__.getErrorMessage)(error));
            } else {
                throw error;
            }
        } finally {
            dispatch(hideLoadingIndication());
        }
    }
    ;
}

This seems like a policy generation error again?

Expected behavior

No response

Screenshots/Recordings

No response

Steps to reproduce

  1. run yarn webpack:lavamoat
  2. open the extension
  3. go through the onboarding (as far as you can)
  4. check the console for the error

Error messages or log output

Detection stage

On a feature branch

Version

12.23.0

Build type

None

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

No response

Severity

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions