Open
Description
Playwright fails to load any browser correctly if one has the following dependency in Cargo.toml
serde_json = { version = "1.0.66", features = [ "arbitrary_precision" ] }
If one removes features = [ "arbitrary_precision"]
, then it works.
This occurs on at least the async-std
and tokio
executors.
I would love to submit a PR to fix this bug, but I have not the foggiest idea how to get started fixing it. :-/
Reproduction case
use std::env;
use playwright::Playwright;
#[async_std::main]
async fn main() -> Result<(), playwright::Error> {
if env::var("TOY_LOG").is_err() {
env::set_var("TOY_LOG", "warn");
}
pretty_env_logger::try_init_custom_env("TOY_LOG").unwrap();
let playwright = Playwright::initialize().await?;
playwright.prepare()?; // Install browsers
log::debug!("Creating browser.");
let chromium = playwright.chromium();
let browser = chromium.launcher().headless(false).launch().await?;
log::debug!("Creating context.");
let context = browser.context_builder().build().await?;
let page = context.new_page().await?;
page.goto_builder("https://en.wikipedia.org/").goto().await?;
log::info!("Success");
Ok(())
}
Logs
Here are the logs you get if you try to load with arbitrary_precision
feature turned on:
DEBUG toy > Creating browser.
DEBUG playwright::imp::core::transport > SEND Req { id: 1, guid: "browser-type@22850ecee7392c91106a2feb3a1d26d5", method: "launch", params: {"headless": Bool(false)} }
DEBUG playwright::imp::core::transport > RECV {"guid":"browser-type@22850ecee7392c91106a2feb3a1d26d5","method":"__create__","params":{"type":"Browser","initializer":{"version":"92.0.4498.0","name":"chromium"},"guid":"browser@c75fc2aa6fc81ca08a6bdf31ba109637"}}
DEBUG playwright::imp::core::transport > RECV {"id":1,"result":{"browser":{"guid":"browser@c75fc2aa6fc81ca08a6bdf31ba109637"}}}
Error: Arc(Transport(Serde(Error("data did not match any variant of untagged enum Res", line: 0, column: 0))))
Traceback
And here is the traceback you get if you change the appropriate ?
to .unwrap()
and run with RUST_BACKTRACE=1
:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Transport(Serde(Error("data did not match any variant of untagged enum Res", line: 0, column: 0)))', src/main.rs:16:68
stack backtrace:
0: rust_begin_unwind
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/panicking.rs:517:5
1: core::panicking::panic_fmt
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/panicking.rs:101:14
2: core::result::unwrap_failed
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/result.rs:1617:5
3: core::result::Result<T,E>::unwrap
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/result.rs:1299:23
4: toy::main::main::{{closure}}
at ./src/main.rs:16:17
5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/future/mod.rs:80:19
6: toy::main::{{closure}}
at ./src/main.rs:5:1
7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/future/mod.rs:80:19
8: <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll::{{closure}}
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:199:17
9: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:60:13
10: std::thread::local::LocalKey<T>::try_with
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/thread/local.rs:399:16
11: std::thread::local::LocalKey<T>::with
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/thread/local.rs:375:9
12: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:55:9
13: <async_std::task::builder::SupportTaskLocals<F> as core::future::future::Future>::poll
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:197:13
14: <futures_lite::future::Or<F1,F2> as core::future::future::Future>::poll
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/future.rs:526:33
15: async_executor::Executor::run::{{closure}}
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.1/src/lib.rs:242:9
16: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/future/mod.rs:80:19
17: async_executor::LocalExecutor::run::{{closure}}
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-executor-1.4.1/src/lib.rs:447:9
18: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/future/mod.rs:80:19
19: async_io::driver::block_on
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-io-1.6.0/src/driver.rs:142:33
20: async_global_executor::reactor::block_on::{{closure}}
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:3:18
21: async_global_executor::reactor::block_on
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/reactor.rs:12:5
22: async_global_executor::executor::block_on::{{closure}}
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:36
23: std::thread::local::LocalKey<T>::try_with
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/thread/local.rs:399:16
24: std::thread::local::LocalKey<T>::with
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/thread/local.rs:375:9
25: async_global_executor::executor::block_on
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-global-executor-2.0.2/src/executor.rs:26:5
26: async_std::task::builder::Builder::blocking::{{closure}}::{{closure}}
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:171:25
27: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current::{{closure}}
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:60:13
28: std::thread::local::LocalKey<T>::try_with
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/thread/local.rs:399:16
29: std::thread::local::LocalKey<T>::with
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/thread/local.rs:375:9
30: async_std::task::task_locals_wrapper::TaskLocalsWrapper::set_current
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/task_locals_wrapper.rs:55:9
31: async_std::task::builder::Builder::blocking::{{closure}}
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:168:17
32: std::thread::local::LocalKey<T>::try_with
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/thread/local.rs:399:16
33: std::thread::local::LocalKey<T>::with
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/std/src/thread/local.rs:375:9
34: async_std::task::builder::Builder::blocking
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/builder.rs:161:9
35: async_std::task::block_on::block_on
at /home/luke/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.10.0/src/task/block_on.rs:33:5
36: toy::main
at ./src/main.rs:5:1
37: core::ops::function::FnOnce::call_once
at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.