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

TypeError: Cannot redefine property: ethereum #4855

Open
yudhomax opened this issue Oct 8, 2024 · 3 comments
Open

TypeError: Cannot redefine property: ethereum #4855

yudhomax opened this issue Oct 8, 2024 · 3 comments
Assignees
Labels
investigate Under investigation and may be a bug. v5 Issues regarding legacy-v5

Comments

@yudhomax
Copy link

yudhomax commented Oct 8, 2024

Ethers Version

5.7.2

Search Terms

No response

Describe the Problem

when i reload the page this error always occure

Code Snippet

window.ethereum = m,
                        Object.defineProperty(window, "ethereum", {
                            set: function(t) {
                                console.log("Setting value:", t),
                                t.isCoin98 && (this.c98walletAggregator = t)
                            },
                            get: function() {
                                return this.c98walletAggregator
                            },
                            enumerable: !0,
                            configurable: !1
                        }),

Contract ABI

No response

Errors

TypeError: Cannot redefine property: ethereum

Environment

No response

Environment (Other)

No response

@yudhomax yudhomax added investigate Under investigation and may be a bug. v5 Issues regarding legacy-v5 labels Oct 8, 2024
@ricmoo
Copy link
Member

ricmoo commented Oct 8, 2024

Is this ethers code?

@yudhomax
Copy link
Author

yudhomax commented Oct 8, 2024

i don't know, but getting error from here
Screenshot from 2024-10-08 11-41-57

@jasonandjay
Copy link

This error has nothing to do with ethers.js

It indicates that the property ethereum has been defined (probably by a browser plugin) and cannot be defined again. However, there is no logic to hijack ethereum in ethers.js. You need to check your code or disable some plugins

This issue can be closed @ricmoo @yudhomax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug. v5 Issues regarding legacy-v5
Projects
None yet
Development

No branches or pull requests

4 participants
@ricmoo @jasonandjay @yudhomax and others