You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use surf to call my backend from a Yew-based WASM frontend running in the browser.
HTTP calls to the backend are typically performed by a frontend application using relative URLs; anyway, this is not possible with surf as every attempt to send a call with a relative URL generates a panic with this message in the browser console:
panicked at 'called `Result::unwrap()` on an `Err` value: RelativeUrlWithoutBase', /home/ufo/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.2.0/src/client.rs:548:42
Stack:
init/imports.wbg.__wbg_new_59cb74e423758ede@http://127.0.0.1:3000/index-3c6d44c9390fc4f2.js:302:19
console_error_panic_hook::Error::new::hd990297f532a9234@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[7058]:0x186a2c
console_error_panic_hook::hook_impl::h80677aeedc307843@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[793]:0xb2e8a
console_error_panic_hook::hook::h1ee90794f5cd7865@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[7797]:0x190de1
core::ops::function::Fn::call::h474424fdd5f0e50d@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[6506]:0x17e209
std::panicking::rust_panic_with_hook::hbdbceb5cd158bf19@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[1843]:0xfd0a2
std::panicking::begin_panic_handler::{{closure}}::h9995bb2f0de4bb38@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[2837]:0x1275b0
std::sys_common::backtrace::__rust_end_short_backtrace::hc7608161a467c002@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[8331]:0x197971
rust_begin_unwind@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[7505]:0x18cfe2
core::panicking::panic_fmt::h3ab5417155b7ba3b@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[8332]:0x1979a7
core::result::unwrap_failed::h9bf99bca88ba05dc@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[3361]:0x138737
core::result::Result<T,E>::unwrap::h33bc93175c1bc582@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[2644]:0x1205a8
surf::client::Client::url::h39313a8f3aaa19cf@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[1191]:0xd4d83
surf::client::Client::get::ha967bf82289d17fc@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[1862]:0xfe06a
ajars_surf::AjarsSurf::request::h6ae85bb0d856083f@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[298]:0x6b5f8
<web_yew_surf::Model as yew::html::component::Component>::update::{{closure}}::h6bffacbfd91ec472@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[258]:0x61af7
<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h402db801b284075c@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[695]:0xa8637
<yew::html::component::scope::Scope<COMP> as yewtil::future::LinkFuture>::send_future::{{closure}}::ha636b22ecbda53c1@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[323]:0x70b63
<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hf132d4cc883e3691@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[2139]:0x10b6e4
wasm_bindgen_futures::task::singlethread::Task::run::h7fe7783a8d04cc40@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[555]:0x9738b
wasm_bindgen_futures::queue::QueueState::run_all::h0079a01c6732e655@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[706]:0xa9b02
wasm_bindgen_futures::queue::Queue::new::{{closure}}::h450bfa8f161ec151@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[4272]:0x15119c
<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::he5c7b3ad9ac2248f@http://127.0.0.1:3000/index-3c6d44c9390fc4f2_bg.wasm:wasm-function[1858]:0xfdd73
__wbg_adapter_27@http://127.0.0.1:3000/index-3c6d44c9390fc4f2.js:222:10
real@http://127.0.0.1:3000/index-3c6d44c9390fc4f2.js:191:20
I am also surprised that it panics instead of returning an error.
The text was updated successfully, but these errors were encountered:
I am trying to use
surf
to call my backend from a Yew-based WASM frontend running in the browser.HTTP calls to the backend are typically performed by a frontend application using relative URLs; anyway, this is not possible with
surf
as every attempt to send a call with a relative URL generates a panic with this message in the browser console:I am also surprised that it panics instead of returning an error.
The text was updated successfully, but these errors were encountered: