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

Cloudflare workers bug since 0.11 #1247

Closed
VictorBulba opened this issue Apr 19, 2021 · 4 comments · Fixed by #1249
Closed

Cloudflare workers bug since 0.11 #1247

VictorBulba opened this issue Apr 19, 2021 · 4 comments · Fixed by #1249
Assignees
Labels
C-bug Category: bug. Something is wrong. This is bad! E-easy Effort: Easy! Start here :D E-pr-welcome The feature is welcome to be added, instruction should be found in the issue.

Comments

@VictorBulba
Copy link
Contributor

Hey!

Looks like something is broken in Cloudflare workers runtime.

Minimal example:

#[wasm_bindgen]
pub async fn handle() -> String {
    let resp = match reqwest::get("https://wtfismyip.com/text").await {
        Ok(resp) => resp,
        Err(err) => return err.to_string(),
    };
    let text = resp.text().await.unwrap();
    text
}

With version 0.10 it works, but with 0.11 it falls into Err arm of the match statement.

Error message:

builder error: JsValue(Error: The 'credentials' field on 'RequestInitializerDict' is not implemented.
Error: The 'credentials' field on 'RequestInitializerDict' is not implemented.
    at worker.js:343:19
    at worker.js:222:22
    at <anonymous>:wasm-function[351]:0x36dc7
    at <anonymous>:wasm-function[49]:0xb3c4
    at <anonymous>:wasm-function[208]:0x31f93
    at <anonymous>:wasm-function[188]:0x30b0d
    at _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0dedee9324219338 (<anonymous>:wasm-function[435]:0x37e0e)
    at __wbg_adapter_26 (worker.js:208:10)
    at real (worker.js:193:20))
@seanmonstar
Copy link
Owner

Hm, that's probably because of #1227. Perhaps a fix is that we could change reqwest to have that internal type be an Option<RequestCredentials>, and so by default if you never set one, it should no longer try to set that field.

@seanmonstar seanmonstar added C-bug Category: bug. Something is wrong. This is bad! E-easy Effort: Easy! Start here :D E-pr-welcome The feature is welcome to be added, instruction should be found in the issue. labels Apr 19, 2021
@bensadiku
Copy link
Contributor

I'll give it a shot :)

@bensadiku
Copy link
Contributor

@VictorBulba I've opened #1249, can you confirm it's fixed?

@VictorBulba
Copy link
Contributor Author

@bensadiku it works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug. Something is wrong. This is bad! E-easy Effort: Easy! Start here :D E-pr-welcome The feature is welcome to be added, instruction should be found in the issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants