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

[Sentry] [Bug]: TypeError: Cannot add property chain_id, object is not extensible for every send transaction #28599

Closed
Unik0rnMaggie opened this issue Nov 21, 2024 · 6 comments · Fixed by #28970
Assignees
Labels
area-Sentry error reporting to sentry regression-beta-12.8.0 Regression bug that was found in beta in release 12.8.0 regression-prod-12.8.0 Regression bug that was found in production in release 12.8.0 release-12.10.0 Issue or pull request that will be included in release 12.10.0 Sev2-normal Normal severity; minor loss of service or inconvenience. team-extension-platform team-wallet-framework type-bug

Comments

@Unik0rnMaggie
Copy link
Contributor

Unik0rnMaggie commented Nov 21, 2024

Describe the bug

There is a console error for every Send Transaction, but the Tx is successful

Uncaught (in promise) TypeError: Cannot add property chain_id, object is not extensible

Expected behavior

No console error

Screenshots/Recordings

Screenshot 2024-11-21 at 11 28 16

Steps to reproduce

  1. Go to any network
  2. Initiate Send transaction for any token
  3. Notice console error

Error messages or log output

Uncaught (in promise) TypeError: Cannot add property chain_id, object is not extensible

Detection stage

In beta

Version

12.8.0

(originally found in a QA build for portfolio view)

Build type

Other (please specify exactly where you obtained this build in "Additional Context" section)

Browser

Chrome

Operating system

MacOS

Hardware wallet

No response

Additional context

QA-5 build

Severity

No response

@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by severity Nov 21, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by team Nov 21, 2024
@Unik0rnMaggie Unik0rnMaggie added team-wallet-ux portfolio-view Used for PRs and issues related to Q4 2024 portfolio view labels Nov 21, 2024
@metamaskbot metamaskbot added the regression-beta-12.7.0 Regression bug that was found in beta in release 12.7.0 label Nov 21, 2024
@Unik0rnMaggie Unik0rnMaggie removed the regression-beta-12.7.0 Regression bug that was found in beta in release 12.7.0 label Nov 21, 2024
@Unik0rnMaggie
Copy link
Contributor Author

Present in qa-7 build

Send.console.error.mov

@hjetpoluru hjetpoluru added the Sev2-normal Normal severity; minor loss of service or inconvenience. label Nov 25, 2024
@Unik0rnMaggie
Copy link
Contributor Author

Present in qa-8 build

Send.Error.mov

@sleepytanya
Copy link
Contributor

@Unik0rnMaggie @jonybur @gambinish
The issue has been present in develop for about a week, is it related to current PR?

@sahar-fehri
Copy link
Contributor

I confirm that im also able to see this in develop; also i'm not able to repro everytime i initiate a transaction, i was able to see the error in console once so far; then i do the same steps to initiate a transaction, and the error is not displayed anymore

@Unik0rnMaggie
Copy link
Contributor Author

Thank you @sleepytanya and @sahar-fehri ! i am also able to see it on the latest develop build.

I removed the portfolio-view label

@Unik0rnMaggie Unik0rnMaggie added regression-main Regression bug that was found on main branch, but not yet present in production and removed portfolio-view Used for PRs and issues related to Q4 2024 portfolio view labels Nov 28, 2024
Copy link

sentry-io bot commented Dec 4, 2024

Sentry Issue: METAMASK-XDAX

@metamaskbot metamaskbot changed the title [Bug]: TypeError: Cannot add property chain_id, object is not extensible for every send transaction [Sentry] [Bug]: TypeError: Cannot add property chain_id, object is not extensible for every send transaction Dec 5, 2024
@metamaskbot metamaskbot added area-Sentry error reporting to sentry regression-prod-12.8.0 Regression bug that was found in production in release 12.8.0 regression-beta-12.7.0 Regression bug that was found in beta in release 12.7.0 and removed regression-main Regression bug that was found on main branch, but not yet present in production regression-prod-12.8.0 Regression bug that was found in production in release 12.8.0 labels Dec 5, 2024
Gudahtt added a commit that referenced this issue Dec 5, 2024
The functions `createEventFragment` and `updateEventFragment` of the
MetaMetricsController were broken recently in the migration to
BaseControllerV2 (#28113). We ended up trying to mutate a piece of
Immer state, resulting in an error.

The affected lines were updated to use `cloneDeep` prior to mutating,
so that we're no longer attempting to mutate a frozen object.

Fixes ##28599
Gudahtt added a commit that referenced this issue Dec 5, 2024
The function `createEventFragment` of the `MetaMetricsController` was
broken recently in the migration to BaseControllerV2 (#28113). We ended
up trying to mutate a piece of Immer state, resulting in an error.

The affected line was updated to use `cloneDeep` prior to mutating,
so that we're no longer attempting to mutate a frozen object.

Fixes ##28599
Gudahtt added a commit that referenced this issue Dec 5, 2024
The function `createEventFragment` of the `MetaMetricsController` was
broken recently in the migration to BaseControllerV2 (#28113). We ended
up trying to mutate a piece of Immer state, resulting in an error.

The affected line was updated to use `cloneDeep` prior to mutating,
so that we're no longer attempting to mutate a frozen object.

Fixes ##28599
Gudahtt added a commit that referenced this issue Dec 5, 2024
The function `createEventFragment` of the `MetaMetricsController` was
broken recently in the migration to BaseControllerV2 (#28113). We ended
up trying to mutate a piece of Immer state, resulting in an error.

The affected line was updated to use `cloneDeep` prior to mutating,
so that we're no longer attempting to mutate a frozen object.

Fixes ##28599
Gudahtt added a commit that referenced this issue Dec 5, 2024
The function `createEventFragment` of the `MetaMetricsController` was
broken recently in the migration to BaseControllerV2 (#28113). We ended
up trying to mutate a piece of Immer state, resulting in an error.

The affected line was updated to use an empty base object as the merge
target, so that we're no longer attempting to mutate a frozen object.

Fixes ##28599
Gudahtt added a commit that referenced this issue Dec 5, 2024
The function `createEventFragment` of the `MetaMetricsController` was
broken recently in the migration to BaseControllerV2 (#28113). We ended
up trying to mutate a piece of Immer state, resulting in an error.

The affected line was updated to use an empty base object as the merge
target, so that we're no longer attempting to mutate a frozen object.

Fixes ##28599
Gudahtt added a commit that referenced this issue Dec 5, 2024
The function `createEventFragment` of the `MetaMetricsController` was
broken recently in the migration to BaseControllerV2 (#28113). We ended
up trying to mutate a piece of Immer state, resulting in an error.

The affected line was updated to use an empty base object as the merge
target, so that we're no longer attempting to mutate a frozen object.

Fixes ##28599
@Gudahtt Gudahtt added regression-prod-12.8 Regression bug that was found in production in release 12.8 and removed regression-beta-12.7.0 Regression bug that was found in beta in release 12.7.0 labels Dec 5, 2024
@metamaskbot metamaskbot added regression-beta-12.8.0 Regression bug that was found in beta in release 12.8.0 and removed regression-prod-12.8 Regression bug that was found in production in release 12.8 labels Dec 5, 2024
Gudahtt added a commit that referenced this issue Dec 5, 2024
The function `createEventFragment` of the `MetaMetricsController` was
broken recently in the migration to BaseControllerV2 (#28113). We ended
up trying to mutate a piece of Immer state, resulting in an error.

The affected line was updated to use an empty base object as the merge
target, so that we're no longer attempting to mutate a frozen object.

Fixes ##28599
github-merge-queue bot pushed a commit that referenced this issue Dec 6, 2024
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

The function `createEventFragment` of the `MetaMetricsController` was
broken recently in the migration to BaseControllerV2 (#28113). We ended
up trying to mutate a piece of Immer state, resulting in an error.

The affected line was updated to use `cloneDeep` prior to mutating, so
that we're no longer attempting to mutate a frozen object.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28970?quickstart=1)

## **Related issues**

Fixes #28599

## **Manual testing steps**

I'm not sure exactly how to reproduce the error using a real build. But
the problem is easy to demonstrate in the "should update existing
fragment state with new fragment props" unit test. The problem is that
we didn't catch this before because Lodash doesn't have strict mode
enabled, so in unit tests the attempt to mutate a frozen object will
silently fail. In a production build, [strict mode is enabled by
LavaMoat](https://github.com/LavaMoat/LavaMoat/blob/7a3896a08b45f667649c46a56f27fe7bf20f4207/packages/lavapack/src/pack.js#L333).

You can reproduce the problem by adding `"use strict"` to the top of the
file `node_modules/lodash/lodash.js` and running the test with the `{},
` removed. Then you can test that adding back `{}` as the initial
parameter fixes the problem.

## **Screenshots/Recordings**

N/A

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
@github-project-automation github-project-automation bot moved this from To be fixed to Fixed in Bugs by severity Dec 6, 2024
@github-project-automation github-project-automation bot moved this from To be fixed to Fixed in Bugs by team Dec 6, 2024
@metamaskbot metamaskbot added the release-12.10.0 Issue or pull request that will be included in release 12.10.0 label Dec 6, 2024
danjm pushed a commit that referenced this issue Dec 6, 2024
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

The function `createEventFragment` of the `MetaMetricsController` was
broken recently in the migration to BaseControllerV2 (#28113). We ended
up trying to mutate a piece of Immer state, resulting in an error.

The affected line was updated to use `cloneDeep` prior to mutating, so
that we're no longer attempting to mutate a frozen object.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28970?quickstart=1)

Fixes #28599

I'm not sure exactly how to reproduce the error using a real build. But
the problem is easy to demonstrate in the "should update existing
fragment state with new fragment props" unit test. The problem is that
we didn't catch this before because Lodash doesn't have strict mode
enabled, so in unit tests the attempt to mutate a frozen object will
silently fail. In a production build, [strict mode is enabled by
LavaMoat](https://github.com/LavaMoat/LavaMoat/blob/7a3896a08b45f667649c46a56f27fe7bf20f4207/packages/lavapack/src/pack.js#L333).

You can reproduce the problem by adding `"use strict"` to the top of the
file `node_modules/lodash/lodash.js` and running the test with the `{},
` removed. Then you can test that adding back `{}` as the initial
parameter fixes the problem.

N/A

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
danjm pushed a commit that referenced this issue Dec 6, 2024
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

The function `createEventFragment` of the `MetaMetricsController` was
broken recently in the migration to BaseControllerV2 (#28113). We ended
up trying to mutate a piece of Immer state, resulting in an error.

The affected line was updated to use `cloneDeep` prior to mutating, so
that we're no longer attempting to mutate a frozen object.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28970?quickstart=1)

Fixes #28599

I'm not sure exactly how to reproduce the error using a real build. But
the problem is easy to demonstrate in the "should update existing
fragment state with new fragment props" unit test. The problem is that
we didn't catch this before because Lodash doesn't have strict mode
enabled, so in unit tests the attempt to mutate a frozen object will
silently fail. In a production build, [strict mode is enabled by
LavaMoat](https://github.com/LavaMoat/LavaMoat/blob/7a3896a08b45f667649c46a56f27fe7bf20f4207/packages/lavapack/src/pack.js#L333).

You can reproduce the problem by adding `"use strict"` to the top of the
file `node_modules/lodash/lodash.js` and running the test with the `{},
` removed. Then you can test that adding back `{}` as the initial
parameter fixes the problem.

N/A

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
@metamaskbot metamaskbot added the regression-prod-12.8.0 Regression bug that was found in production in release 12.8.0 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Sentry error reporting to sentry regression-beta-12.8.0 Regression bug that was found in beta in release 12.8.0 regression-prod-12.8.0 Regression bug that was found in production in release 12.8.0 release-12.10.0 Issue or pull request that will be included in release 12.10.0 Sev2-normal Normal severity; minor loss of service or inconvenience. team-extension-platform team-wallet-framework type-bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants