-
Notifications
You must be signed in to change notification settings - Fork 716
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
this.events.off is not a function error if Node polyfill #4064
Comments
I am getting the same issue in my react native wallet app, have you found any solution for this? |
hey @peterpeterparker any good news on this? I'm facing the same problem 😢 |
Not really, @adrianotadao. I opened the issue, documented it, and provided a sample repo, but I did not debug the WalletConnect code. That said, in our app, after bumping a few dependencies, I actually noticed that we weren't requiring the usage of the polyfier plugin ( |
Issue closed without without any comments or references? Was it solved or it won't be solved? |
Just to share how we solved it here with esbuild. import { polyfillNode } from "esbuild-plugin-polyfill-node";
const esbuildOptions = {
...otherOptions,
plugins: [
polyfillNode({
globals: {
global: false,
__dirname: false,
__filename: false,
buffer: false,
process: false,
navigator: false,
},
polyfills: {
_stream_duplex: true,
_stream_passthrough: true,
_stream_readable: true,
_stream_transform: true,
_stream_writable: true,
assert: true,
"assert/strict": false,
async_hooks: false,
buffer: false,
child_process: "empty",
cluster: "empty",
console: false,
constants: true,
crypto: "empty",
dgram: "empty",
diagnostics_channel: false,
dns: "empty",
domain: true,
events: true,
fs: "empty",
"fs/promises": false,
http: true,
http2: false,
https: true,
module: "empty",
net: "empty",
os: true,
path: true,
perf_hooks: false,
process: true,
punycode: true,
querystring: true,
readline: "empty",
repl: "empty",
stream: true,
string_decoder: true,
sys: true,
timers: true,
"timers/promises": false,
tls: "empty",
tty: true,
url: true,
util: true,
v8: false,
vm: true,
wasi: false,
worker_threads: false,
zlib: true,
},
}),
],
}; ps. Of course you must enable or disable the ones that make sense for you. |
Hey @glitch-txs don't want to annoy you but, can I ask you a short feedback given that you closed this issue? |
Hi @peterpeterparker I have might missread, thought this was resolved. Seems like the plugin is overriding some global methods used by the SDK, is this correct? Feel free to reopen otherwise. Sorry I missed the earlier comments 🙏 |
Thanks for the feedback @glitch-txs ! Indeed I think polyfilling NodeJS with vite / esbuild seems to override some global methods used by the SDK. I removed the plugin which "resolved" the issue but, I just noticed that I may need to polyfill in some other cases. So I'm still interested for a solution. I cannot reopen the issue, only option provided by GitHub is "comment". So, can you reopen it? |
is the plugin in the latest version? |
Yeah I think everything is up-to-date in the sample repo I provided if I remember correctly. https://github.com/peterpeterparker/web3wallet-issue-3913 |
Any update on this ? |
Update on this for react native? |
* Use different plugin for polyfilling see WalletConnect/walletconnect-monorepo#4064 (comment) * Show wallet connect dialog on top of the other * Fix missing buffer implementation due to conflicting polyfills
Pulling in latest v2.0 build seems to have fixed for me |
Just tried
|
Hey everybody,
If this interpretion is right, the problem can be solved by adding the required version of the If you are using pnpm, you can patch the package.json of these packages like in the following snippet. Otherwise I think you need to wait for a release with adjusted dependencies or configure how your bundler resolves the "pnpm": {
"packageExtensions": {
"@walletconnect/jsonrpc-provider": {
"dependencies": {
"events": "^3.3.0"
}
}
}
}, |
Same issue with vite used by Nuxt 3 |
Hey everyone! I found the same issue in a React Native project, and in my case after getting this error no more events were received from the paired apps, and neither send requests, and the application had to be closed and opened again. And even so, eventually the error would still appear again and the communication with paired apps lost again. I was able to solve the issue thanks this comment. In my case, despite the having |
Hi everyone, Thank you for the feedback and suggestions here, in particular @niklasnatter with the detailed analysis 💯 🙏 We're looking to patch affected packages where there is an apparent possibility of |
For what it's worth, I tested the latest version of WalletConnect v1.14.0, and an issue persists. If Buffer is polyfilled for local development with esbuild, using WalletConnect results in the following error:
|
Issue
@walletconnect/web3wallet
throws an errorthis.events.off is not a function
when pairing a session when Node libraries are polyfilled for local development in vite based project.This issue started to occur in recent releases, and my current workaround is to stick to version
v1.9.1
.Notes
This is a follow-up to issue #3913, which you closed, requesting a minimal sample repo to replicate this issue. I am providing it here.
Versions
Reproduction
Steps to reproduce the behavior:
Try to establish a connection for example with https://app.uniswap.org/swap?chain=goerli
Expected behavior
Being able to pair a session without errors.
Screenshots
The text was updated successfully, but these errors were encountered: