sentry-rust icon indicating copy to clipboard operation
sentry-rust copied to clipboard

Wasm support?

Open MTRNord opened this issue 5 years ago • 10 comments
trafficstars

Hi wasm based rust currently fails in all kind of ways.

Especially this often happens when compiling:

error[E0599]: no method named `as_sock` found for reference `&udp::UdpBuilder` in the current scope
    --> /home/marcel/.cargo/registry/src/github.com-1ecc6299db9ec823/net2-0.2.34/src/ext.rs:1558:22
     |
1558 |         get_opt(self.as_sock(), SOL_SOCKET, SO_ERROR).map(int2err)
     |                      ^^^^^^^ method not found in `&udp::UdpBuilder`

Is it possible to get wasm support in the future?

MTRNord avatar Jun 03 '20 13:06 MTRNord

We actually talked about this internally a few days ago. So far we haven’t tried it, and I don’t think it will be a priority any time soon. However, the new modularized sentry-core should be a much better starting point for this.

Swatinem avatar Jun 03 '20 14:06 Swatinem

It would be awesome at some point :) (Especially as I currently work with yew/wasm)

MTRNord avatar Jun 03 '20 16:06 MTRNord

Has there been any movement on this issue? :) I see there are some Wasm related types in the documentation.

Diggsey avatar Dec 15 '21 17:12 Diggsey

I know that leaving +1's are generally a bad practice, but I wanted to mention that particularly now that serving API's via WASM through Fastly or CloudFlare, this is a missing piece that would be very nice to have.

GeeWee avatar May 11 '22 06:05 GeeWee

I'll be digging through this shortly to see if anything has changed, but has anyone even tried recently? If I add these lines to my wasm project, I don't get any errors:

sentry = {version = "0.29.1", default-features = false}
getrandom = { version = "0.2.8", features = ["js"] }

The second line is necessary because sentry requires getrandom but does not set the js feature, which is necessary to get random numbers from a wasm (in JS) context. If I don't set default-features = false in sentry then the first error I get is about not having OpenSSL headers, and obviously that is not happening in a WASM context. But I see that reqwest does support WASM, so that stuff shouldn't be necessary...

hut8 avatar Dec 05 '22 19:12 hut8

@hut8 I got it working. However, using the sentry package, you have to do all the serializing of data manually (and I think this will be platform specific too, I'm working on CloudFlare workers). If this is of interest to you and you are interested to working on it, reach me by email.

omarabid avatar Dec 06 '22 05:12 omarabid

It looks like no matter what, I can't use the sentry crate at all, and I believe that's @omarabid 's experience too. I get a panic here:

 at std::time::SystemTime::now::h69200a4ca613d8a5
 at sentry_types::auth::auth_from_dsn_and_client::h4dc5020090240e03

For a browser WASM environment, I think we would have to do a rather large overhaul.

However, the ureq transport at least builds 😄

hut8 avatar Dec 08 '22 17:12 hut8

@hut8 thanks to you I actually got sentry to build too, but then in the browser its not going to start at all, as if sentry is completely blocking the dioxus web initializer code.

ChrisB9 avatar Jun 23 '23 21:06 ChrisB9

on my side I have issues with "time". I get this error:

time not implemented on this platform', library/std/src/sys/wasm/../unsupported/time.rs:31:9

rednaks avatar Jun 25 '23 13:06 rednaks