A hanging Promise was canceled - Rust

Hey there, I'm using cloudflare workers with the worker crate. I have a route that looks like so:
pub async fn create_payment_link(mut req: Request, ctx: RouteContext<()>) -> Result<Response> {
println!("Request received");
let request_ok = verify_request(&ctx, &req);
println!("request ok: {request_ok:?}");
if !request_ok {
Response::error("Invalid Authorization", 403)
} else {
let data: CreatePaymentLink = req.json().await?;
let link = StripeClient::create_payment_link(&ctx, &data.price_id).await?;
Response::ok(link)
}
pub async fn create_payment_link(mut req: Request, ctx: RouteContext<()>) -> Result<Response> {
println!("Request received");
let request_ok = verify_request(&ctx, &req);
println!("request ok: {request_ok:?}");
if !request_ok {
Response::error("Invalid Authorization", 403)
} else {
let data: CreatePaymentLink = req.json().await?;
let link = StripeClient::create_payment_link(&ctx, &data.price_id).await?;
Response::ok(link)
}
the StripeClient::create_payment_link internally uses worker::Fetch::Request. Let me know if it would help if I also provided the the code for this. I get an error that looks like so whenever the route is requested (currently testing locally):
A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.
✘ [ERROR] Uncaught (in response) Error: The script will never generate a response.
A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.
✘ [ERROR] Uncaught (in response) Error: The script will never generate a response.
I'm using worker = 0.0.18
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server