Comments (11)
As I mentioned, axum needs to be updated. You have 0.6.
from tower-sessions.
It's hard to say exactly what state your build was in when it seemed to not be working.
Regardless, the flag is not needed and as I mentioned not intended to be used directly unless you're authoring a store that requires the deletion task.
from tower-sessions.
Your dependencies are not updated such that the types match.
Without seeing your code, I can guess it's probably axum or http: both need to be updated. L
You will also need to ensure the deletion trait is in scope.
from tower-sessions.
[dependencies]
anyhow = "1.0.75"
argon2 = "0.5.2"
askama = { version = "0.12.1", features = ["serde_json"] }
axum = { version = "0.6.20", features = ["macros"] }
dotenvy = "0.15.7"
dry-run = "0.0.0"
lazy_static = "1.4.0"
once_cell = "1.18.0"
regex = "1.10.2"
secrecy = { version = "0.8.0", features = ["serde"] }
serde = { version = "1.0.189", features = ["derive"] }
serde_json = "1.0.107"
sqlx = { version = "0.7.2", features = ["postgres", "runtime-tokio-rustls","time","uuid"] }
time = { version = "0.3.30", features = ["serde","macros","formatting"] }
tokio = { version = "1.33.0", features = ["full"] }
tower = "0.4.13"
tower-http = { version = "0.5.0", features = ["fs"] }
tower-sessions = { version = "0.7.0", features = ["postgres-store"] }
tracing = "0.1.40"
tracing-subscriber = "0.3.17"
uuid = { version = "1.5.0", features = ["v4", "fast-rng", "macro-diagnostics", "serde"] }
validator = { version = "0.16.1", features = ["derive"] }
from tower-sessions.
there is something missing
from tower-sessions.
still has this
error[E0599]: no method named
continuously_delete_expiredfound for struct
PostgresStorein the current scope --> src/lib.rs:85:14 | 83 | / session_store 84 | | .clone() 85 | | .continuously_delete_expired(tokio::time::Duration::from... | | -^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in
PostgresStore| |_____________| |
from tower-sessions.
As I said, you need to bring the trait in scope.
Please make sure you follow the examples and give us complete, working examples so we can help you.
from tower-sessions.
which trait ?
from tower-sessions.
I also encountered this when upgrading from 0.4. I already had this working with use tower_sessions::session_store::ExpiredDeletion
however it required the feature deletion-task
which previously was on tower-sessions
but was not there anymore, nor moved to tower-sessions-sqlx-store
so I had to do some digging.
It seems that the missing instruction, which I don't see in any of the docs or git repos, is to add to my cargo toml:
tower-sessions-core = { version = "0.10.0", features = ["deletion-task"] }
Is this mentioned somewhere that I am missing? There are no complete examples that have this referenced, e.g.
https://github.com/maxcountryman/tower-sessions-stores/blob/main/sqlx-store/examples/postgres.rs
I do see this here -- but I only found it after knowing what to look for, and it was not obvious that this was related:
https://github.com/maxcountryman/tower-sessions-stores/blob/3d60f41bbca0728b95cffeea5922e31704c036a2/sqlx-store/Cargo.toml#L26
An ideal location from my perspective would be to mention this in the rdoc that covers adding this functionality:
https://docs.rs/tower-sessions/latest/tower_sessions/#session-expiry-management
Thanks for the great project that clearly takes a lot of work to provide docs for, and the nontrivial improvements that have been made over its lifetime already. Hopefully this is an easy opportunity to clarify things somewhere.
from tower-sessions.
The deletion-task
flag is enabled by tower-sessions-sqlx-store
. What this means is you do not enable it directly anymore and generally speaking on store authors would enable this feature.
This is covered in the release notes where we migrate a SQLx example, including the Cargo.toml
as an example. Generally speaking, the release notes and CHANGELOG are the places folks should be looking when updating breaking releases.
You should not enable deletion-task
directly and if you find that you have to the most likely explanation is that you're using incompatible versions of tower-sessions
and tower-sessions-sqlx-store
.
from tower-sessions.
Thank you for your response! :) I very much want to get this sorted out.
I have this in my Cargo, I believe these are the relevant bits, and I believe these are the latest versions of all of these (per crates.io):
axum = { version = "0.7.4", features = ["multipart"] }
tower-sessions = "0.11.0"
tower-sessions-core = { version = "0.11.0", features = ["deletion-task"] }
tower-sessions-sqlx-store = { version = "0.11.0", features = ["postgres"] }
sqlx = { version = "0.7.4", features = ["runtime-tokio", "tls-rustls", "postgres"] }
My code absolutely did not compile until I added tower-sessions-core
with deletion-task
, and it was giving the same first error mentioned above.
That said, perhaps there was just something off somewhere else as well because now that it is all compiling fine, and given your insistence, I have removed that line from cargo and it still all compiles. So... I guess it is not needed indeed? Idk why, but that definitely was a thing that did not work until I did that.
from tower-sessions.
Related Issues (20)
- Divide each store to its own crate HOT 6
- When adding an Axum layer: "the trait `From<Box<(dyn StdError + std::marker::Send + Sync + 'static)>>` is not implemented for `Infallible`" HOT 5
- i do not see a postgres table although session works HOT 1
- cannot infer type of the type parameter `T` declared on the struct `HandleErrorLayer` HOT 2
- function or associated item not found in 'Session' HOT 2
- Add support for Postgres store with tokio-postgres along with bb8-postgres. Implementation attached.
- Facilitate custom `SessionStore` implementation testing HOT 12
- Use `core::time::Duration` instead of `time::Duration`
- Redis example needs pool not a client
- Still waiting on your answer regarding #59 (Diesel store implementation) HOT 3
- with_expiry(Expiry::OnSessionEnd) does not seem to work
- Does .flush() work correctly when a cookie domain is set?
- version 0.10.3 broke SemVer guarantees HOT 3
- Breaking change in v0.10.4 HOT 4
- Inserting forces a sesssion read which could cause the insert to error HOT 1
- set_expiry() does not work HOT 5
- Max-Age of Cookie not updates on set_expiry() HOT 3
- Session Ids can collide
- Version 0.12.0 not compatible with redis-store 0.11.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tower-sessions.