Skip to content

Failed to use Openapi SDK in Actix-web async handler #2

@francescobianco

Description

@francescobianco

Description:
Trying to call the Openapi SDK client from an Actix-web async handler:

async fn get_user() -> impl Responder {
    let client = openapi_sdk::Client::new("API_KEY");
    let user = client.get_user(123).await.unwrap();
    HttpResponse::Ok().json(user)
}

Getting: error: future cannot be sent between threads safely.
Probably related to Actix’s runtime. How should we properly integrate Openapi SDK async calls with Actix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions