actix / actix-extras

A collection of additional crates supporting the actix and actix-web frameworks.
https://actix.rs
Apache License 2.0
787 stars 206 forks source link

deadpool_redis RedisSessionStore breaking changes in latest releases #464

Closed 0xd-0 closed 2 months ago

0xd-0 commented 2 months ago

Your issue may already be reported! Please search on the actix-extras issue tracker before creating one.

Expected Behavior

Using the simple example referenced in the docs:

let redis_cfg = Config::from_url("redis://127.0.0.1:6379");
let redis_pool = redis_cfg.create_pool(Some(Runtime::Tokio1)).unwrap();
let store = RedisSessionStore::new_pooled(redis_pool);

Current Behavior

error[E0277]: the trait bound `deadpool::managed::Pool<deadpool_redis::Manager, deadpool_redis::Connection>: From<deadpool::managed::Pool<Manager, deadpool_redis::Connection>>` is not satisfied

let store = RedisSessionStore::new_pooled(redis_pool);
    |                 ----------------------------- ^^^^^^^^^^ the trait `From<deadpool::managed::Pool<Manager, deadpool_redis::Connection>>` is not implemented for `deadpool::managed::Pool<deadpool_redis::Manager, deadpool_redis::Connection>`, which is required by `deadpool::managed::Pool<Manager, deadpool_redis::Connection>: Into<deadpool::managed::Pool<deadpool_redis::Manager, deadpool_redis::Connection>>`
    |                 |
    |                 required by a bound introduced by this call
    |
    = note: required for `deadpool::managed::Pool<Manager, deadpool_redis::Connection>` to implement `Into<deadpool::managed::Pool<deadpool_redis::Manager, deadpool_redis::Connection>>`
note: required by a bound in `RedisSessionStore::new_pooled`
   --> .../actix-session-0.10.1/src/storage/redis_rs.rs:144:20
    |
143 |     pub async fn new_pooled(
    |                  ---------- required by a bound in this associated function
144 |         pool: impl Into<deadpool_redis::Pool>,
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `RedisSessionStore::new_pooled`

error[E0277]: the trait bound `deadpool::managed::Pool<deadpool_redis::Manager, deadpool_redis::Connection>: From<deadpool::managed::Pool<Manager, deadpool_redis::Connection>>` is not satisfied
   --> src/main.rs:8:14
    |
8   |     let store = RedisSessionStore::new_pooled(redis_pool);
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<deadpool::managed::Pool<Manager, deadpool_redis::Connection>>` is not implemented for `deadpool::managed::Pool<deadpool_redis::Manager, deadpool_redis::Connection>`, which is required by `deadpool::managed::Pool<Manager, deadpool_redis::Connection>: Into<deadpool::managed::Pool<deadpool_redis::Manager, deadpool_redis::Connection>>`
    |
    = note: required for `deadpool::managed::Pool<Manager, deadpool_redis::Connection>` to implement `Into<deadpool::managed::Pool<deadpool_redis::Manager, deadpool_redis::Connection>>`
note: required by a bound in `RedisSessionStore::new_pooled`
   --> .../actix-session-0.10.1/src/storage/redis_rs.rs:144:20
    |
143 |     pub async fn new_pooled(
    |                  ---------- required by a bound in this associated function
144 |         pool: impl Into<deadpool_redis::Pool>,
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `RedisSessionStore::new_pooled`

Steps to Reproduce (for bugs)

See above.

Context

These are breaking changes for latest versions of deadpool_redis/actix-session

Your Environment

rustc 1.80.1 (3f5fd8dd4 2024-08-06)

Cargo.toml [package] name = "actix-redis-test" version = "0.1.0" edition = "2021"

[dependencies] actix-session = { version = "0.10.1", features = ["redis-pool", "redis-session"] } deadpool-redis = "0.17.2"

robjtede commented 2 months ago

you're using an incompatible version of deadpool-redis, session v0.10 supports deadpool-redis v0.16 so you should use that for now

- deadpool-redis = "0.17.2"
+ deadpool-redis = "0.16"
0xd-0 commented 2 months ago

Confirmed, thank you. Shouldn't there be a dependency restriction flagging/preventing this when doing a cargo upgrade?

robjtede commented 2 months ago

"cargo update" does this correctly, I'm not sure what "cargo upgrade" is.

0xd-0 commented 2 months ago

Lesson learned, apparently it does an explicit upgrade, not sure why I did that instead of update. Thanks again!