Questions tagged [rust-actix]

Actix is a rust library built on the Actor Model which allows applications to be written as a group of independently executing but cooperating "Actors" which communicate via messages.

Actix (source code) is a Rust actors framework.

233 questions
0
votes
1 answer

actix_web + tera tamplates give me [actix_web::data] Failed to extract `Data` for `index` handler wrap the data with `Data::new()`

I tried to make actix-web and Tera work together, from examples I found online. This is my code: use actix_web::{get, web, Result, App, HttpServer, HttpRequest, Responder, HttpResponse}; use serde::{Deserialize,Serialize}; use tera::{Tera,…
user63898
  • 29,839
  • 85
  • 272
  • 514
0
votes
0 answers

How to extract multiple data points from actix_web request in middleware

I'm trying to get the following to work but it runs into moving the req to extract path and app data from it. web::scope("/{entity_id}") .wrap_fn(|req, srv| { let entity_id = req …
Deep Vora
  • 318
  • 3
  • 13
0
votes
1 answer

Returning 204 No Content from Actix Web

I have a function, with the signature: async fn index(bearer_control: web::Json) -> Result { It is used an a web server: HttpServer::new(|| App::new().route("/", web::post().to(index))) .bind_openssl("127.0.0.1:1618",…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
0
votes
0 answers

Postgre Row Retuning

I am using Actix with PostgreSQL through Sea-orm. Currently, my update function returns the entire row of data. However, I want it to return only the updated columns, in this case, "full_name" and "updated_at". Here is the function in…
0
votes
1 answer

actix-web error accepting connection: Too many open files (os error 24)

I am using actix-web for an HTTP server, it usually has about 200 requests per 12 seconds, After the first few requests I am continuously getting this error [2023-07-23T07:39:48Z ERROR actix_server::accept] error accepting connection: Too many open…
Emmanuel Thomas
  • 159
  • 1
  • 12
0
votes
0 answers

How to match `/foo.*` prefix in Actix?

I would like to handle these cases in Actix: /foo /foo/ /foo/.* (anything including slashes) Note that foo is a constant string, and I do not need to actually parse the path. Instead, in my handler I will pub async fn on_foo( client:…
Yuri Astrakhan
  • 8,808
  • 6
  • 63
  • 97
0
votes
1 answer

Trait is not implemented for std::string::String

I am almost sure I had this working a couple months a go, but now I came back to add some other functions to the API and it has type errors on all my sqlx calls. here is the error: the trait…
rek2
  • 101
  • 12
0
votes
0 answers

Why 'do_send' function fails?

I use actix 0.13.0 Error mismatched types expected Connect, found Disconnect impl Actor for WsChatSession { type Context = ws::WebsocketContext; fn started(&mut self, ctx: &mut Self::Context) { self.hb(ctx); let addr =…
0
votes
0 answers

Why am I getting this error when executing the request?

Error message: thread 'actix-rt|system:0|arbiter:1' panicked at 'Error deleting task: DatabaseError(__Unknown, "database is locked")', src\handlers\tasks_handlers.rs:54:10 note: run with `RUST_BACKTRACE=1` environment variable to display a…
0
votes
0 answers

Actix Token Auth for Scope

I made a Actix Webserver which includes a scope ("/api") with a few routes. Now I want to expose the API but I want to limit the access via tokens and I found a way to do it by getting the body in a route and checking if the token is correct…
raphiel
  • 711
  • 2
  • 9
  • 24
0
votes
0 answers

Autoconnect to Rust-Actix-Server

I have a Rust server with Actix. As clients I use Raspberrys (Raspberry Pi OS with chromium). How can the Raspberrys find the server automatically on any network? The end user should only have to start the server program and the Raspberrys and not…
nino
  • 1
0
votes
0 answers

different Result types when using actix-web

I'm creating an API in actix-web. The project uses rusqlite, but in order for me to "share" the database between services I had to use r2d2 (that's what Bing AI told me). Now when the function returns the type std::io::Result with the get() function…
VenoX
  • 11
  • 2
0
votes
2 answers

What is the difference between HttpServer::listen() and HttpServer::bind() in actix-web?

I'm currently working on an actix-web application but I have some difficulty in understanding how HttpServer.listen() and HttpServer.bind() are different and what do these functions do.
0
votes
1 answer

Actix Web streaming with reqwest: Duration not sent

I have the problem that the example of the actix web streaming proxy is not working as expected. You can find my code below. What I want to achieve: Stream an mp3 from another server from my backend so I can get around CORS and handing over the IP…
SamTV
  • 147
  • 1
  • 11
0
votes
0 answers

ARMv7 Docker build "no matching package named `actix` found"

I get this error when building a Dockerfile with Buildx on my Mac Mini. The amd64 and arm64 images are built without a problem. The Dockerfile looks like this: # syntax = docker/dockerfile:experimental FROM library/node:lts-bullseye as…
SamTV
  • 147
  • 1
  • 11