Skip to content

TypeError: Cannot redefine property: info #34478

@itsyoboieltr

Description

@itsyoboieltr

Describe the bug

TypeError: Cannot redefine property: info

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
Error generating stack: Cannot redefine property: info
TypeError: Cannot redefine property: info
  at Object.defineProperties (<anonymous>)
  at disableLogs (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-node_modules_q.19b9bb2c7805f73d4c16.js:30982:28)
  at describeNativeComponentFrame (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-node_modules_q.19b9bb2c7805f73d4c16.js:31075:17)
  at describeFunctionComponentFrame (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-node_modules_q.19b9bb2c7805f73d4c16.js:31188:24)
  at describeFiber (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-node_modules_q.19b9bb2c7805f73d4c16.js:31251:28)
  at getStackByFiberInDevAndProd (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-node_modules_q.19b9bb2c7805f73d4c16.js:31267:29)
  at getCurrentFiberStackInDev (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-node_modules_q.19b9bb2c7805f73d4c16.js:31362:24)
  at ReactDebugCurrentFrame.getStackAddendum (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-node_modules_q.19b9bb2c7805f73d4c16.js:73213:30)
  at printWarning (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-node_modules_q.19b9bb2c7805f73d4c16.js:30282:52)
  at error (chrome-extension://hebhblbkkdabgoldnojllkipeoacjioc/js-node_modules_q.19b9bb2c7805f73d4c16.js:30274:17) 

This function is failing:

 function disableLogs() {
            {
                if (disabledDepth === 0) {
                    /* eslint-disable react-internal/no-production-logging */ prevLog = console.log;
                    prevInfo = console.info;
                    prevWarn = console.warn;
                    prevError = console.error;
                    prevGroup = console.group;
                    prevGroupCollapsed = console.groupCollapsed;
                    prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
                    var props = {
                        configurable: true,
                        enumerable: true,
                        value: disabledLog,
                        writable: true
                    }; // $FlowFixMe Flow thinks console is immutable.
                    Object.defineProperties(console, {
                        info: props,
                        log: props,
                        warn: props,
                        error: props,
                        group: props,
                        groupCollapsed: props,
                        groupEnd: props
                    });
                /* eslint-enable react-internal/no-production-logging */ }
                disabledDepth++;
            }
        }

It tries to run Object.defineProperties on the immutable console, redefining its info property. This is something react does internally. I wonder if we can just let react do its own thing with the console?

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