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

Bug: Polyfill Problems in XMTP v3 #857

Open
technohippies opened this issue Mar 4, 2025 · 6 comments
Open

Bug: Polyfill Problems in XMTP v3 #857

technohippies opened this issue Mar 4, 2025 · 6 comments
Labels
Browser SDK bug Something isn't working

Comments

@technohippies
Copy link

Describe the bug

Hey team XMTP,

V3 is a huge update, congratulations! I’m having problems with polyfills + workers in v3. I can send/receive about 5-10 messages, and then I routinely get errors from the Worker, which I believe is the stream listener.

I’m getting errors like:

index.js?v=73adc55f:1 Uncaught Error: expected `,` or `}` at line 1 column 20459
    at Worker.s (index.js?v=73adc55f:1:2076)
s @ index.js?v=73adc55f:1
index.js?v=73adc55f:1 Uncaught Error: expected `,` or `}` at line 1 column 21991
    at Worker.s (index.js?v=73adc55f:1:2076)
s @ index.js?v=73adc55f:1
2index.js?v=73adc55f:1 Uncaught Error: expected `,` or `}` at line 1 column 4093
    at Worker.s (index.js?v=73adc55f:1:2076)
s @ index.js?v=73adc55f:1
index.js?v=73adc55f:1 Uncaught Error: expected `,` or `}` at line 1 column 21991
    at Worker.s (index.js?v=73adc55f:1:2076)
s @ index.js?v=73adc55f:1
index.js?v=73adc55f:1 Uncaught Error: expected `,` or `}` at line 1 column 20459
    at Worker.s (index.js?v=73adc55f:1:2076)

I'm not actually looking for a fix, because I've concluded that I need boilerplate in order to understand how to use the browser-sdk. How these polyfills work, both with and without workers doesn't seem trivial.

If you could make a boilerplate with XMTP + Vite v6, it would be much appreciated. My project seems to have it mostly working, but the stream often fails, and messages aren't received from the stream.

Thank you!

Cross listed: https://community.xmtp.org/t/problems-with-stream-v3-workers-polyfills/884

Expected behavior

No response

Steps to reproduce the bug

You can run my project https://github.com/technohippies/scarlett_vite or visit the URL there, but the code is a mess. I had AI try to fix it, and it was mostly successful, but the occasional stream crashes suggest something more.

@technohippies technohippies added the bug Something isn't working label Mar 4, 2025
@technohippies
Copy link
Author

technohippies commented Mar 4, 2025

I tried cloning xmtp.chat, and it seems to have errors with the workers too? Clearly it's running on the site though, so I must be doing something wrong. Feel free to reach out on Discord if more convenient
Image

@insipx
Copy link
Contributor

insipx commented Mar 4, 2025

Hey @technohippies ! Thanks for the bug report. This should be fixed in an upcoming browser-sdk release, it was fixed in libxmtp in this pr. The root of the issue occurred because of a deserialization bug in the underlying HTTP stream coming from the libxmtp wasm binary.

I'll keep this issue updated with progress on the next release, and close the issue once you are able to confirm it fixed your problem

@technohippies
Copy link
Author

Thank you! Regarding the example, didn't realise I had to download the entire project and build from root. Got that working, so I can at least continue building my backend. Looking forward to the release

@rygine
Copy link
Collaborator

rygine commented Mar 6, 2025

hey @technohippies, do you still have this issue with the latest browser SDK?

@technohippies
Copy link
Author

hey @technohippies, do you still have this issue with the latest browser SDK?

Testing shortly! Thank you!!

@lynhan318
Copy link

lynhan318 commented Mar 10, 2025

I'm facing the same problem.

I pushed the code reproduce the issue here:
https://github.com/lynhan318/xmtp-v3-playground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Browser SDK bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants