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

Cannot read properties of undefined (reading 'default') #13

Open
Wapaca opened this issue Feb 8, 2024 · 4 comments
Open

Cannot read properties of undefined (reading 'default') #13

Wapaca opened this issue Feb 8, 2024 · 4 comments

Comments

@Wapaca
Copy link

Wapaca commented Feb 8, 2024

Hello,

I'm trying to implement wombat wallet but either with nuxt 2 or nuxt 3 i get the error in the title. It can happen from two files:

on wallet-plugin-wombat.js
`} else if (typeof self !== 'undefined') {
ws$1 = self.WebSocket || self.MozWebSocket;
}

var browser$3$1 = ws$1;

browser$3$1.default;

var inherits$d$1;
if (typeof Object.create === 'function'){`

browser$3$1 is undefined

And on protocol-scatter.m.js

`} else if (typeof self !== 'undefined') {
ws = self.WebSocket || self.MozWebSocket;
}

var browser$3 = ws;

browser$3.default;

var inherits$d;
if (typeof Object.create === 'function'){
inherits$d = function inherits(ctor, superCtor) {`

Same browser variable is undefined.

I'm not sure why i get the error, you can check on this nuxt 3 repo https://github.com/Wapaca/waxel_claim_ninjas/tree/add-wombat this branch doesn't work but the master with only anchor and mycloudwallet does.

@aaroncox
Copy link
Member

aaroncox commented Feb 8, 2024

Hrm, seems like the Scatter SDKs that Wombat uses aren't building properly. I'll circulate this with the team and see if they have any ideas.

@dafuga
Copy link
Contributor

dafuga commented Feb 8, 2024

Hey @Wapaca ! My best guess is that you are running into this error because nuxt is trying to run your code in node during server side rendering. Unfortunately, the Scatter SDK (which is a dependency of the Wombat plugin) only works in the browser. Your best bet is probably going to be to load the plugin dynamically in a part of your code that will only run in the browser. You can use what we did in the starter kit as a reference: https://github.com/wharfkit/starter/blob/main/eos/src/index.ts#L23

@Wapaca
Copy link
Author

Wapaca commented Feb 9, 2024

Hi @dafuga your solution worked thanks. I pushed into the add-wombat branch of the above repo + pushed it here https://waxeltool.waxpaca.fr/ .

I still can't manage to login with wombat desktop but i get up to the same error than on other websites (including alcor which use their own scatter wrapper). I installed wombat desktop yesterday and it's the first time i'm using it, maybe i should try with the mobile version or it doesn't like me having Anchor too.

@dafuga
Copy link
Contributor

dafuga commented Feb 9, 2024

Hi @Wapaca, we just tried Wombat desktop and it seems like the process for third party sites to login and trigger transactions is broken. You can use their in-app browser, but unfortunately you won't be able to leverage the wombat plugin like you are trying to. We are hoping that they will fix that at some point, but in the meantime there isn't much we can do to help you on that front. The mobile app on the other hand should work with the plugin (at least it did the last time we tried it) as long as you don't also have Anchor mobile installed (because they use the same ESR protocol, having both installed can cause issues).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants