Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build against actix_web 4.0.0-beta.14 #23

Closed
tl8roy opened this issue Dec 15, 2021 · 4 comments · Fixed by #24
Closed

Fails to build against actix_web 4.0.0-beta.14 #23

tl8roy opened this issue Dec 15, 2021 · 4 comments · Fixed by #24

Comments

@tl8roy
Copy link

tl8roy commented Dec 15, 2021

After trying to update to beta.14, I get the following error. The second one looks like a quick fix. Not so sure about the first one.

error[E0599]: no method named `extensions` found for reference `&RequestHead` in the current scope
  --> /home/.cargo/git/checkouts/actix-web-grants-fc366f5a984b4e1f/f2f9964/src/guards.rs:44:14
   |
44 |             .extensions()
   |              ^^^^^^^^^^ method not found in `&RequestHead`

error[E0599]: no method named `extensions` found for struct `HttpRequest` in the current scope
  --> /home/.cargo/git/checkouts/actix-web-grants-fc366f5a984b4e1f/f2f9964/src/permissions/mod.rs:97:17
   |
97 |             req.extensions()
   |                 ^^^^^^^^^^ method not found in `HttpRequest`
   |
  ::: /home/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-http-3.0.0-beta.15/src/http_message.rs:29:8
   |
29 |     fn extensions(&self) -> Ref<'_, Extensions>;
   |        ---------- the method is available for `HttpRequest` here
   |
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
   |
16 | use actix_web::HttpMessage;

I have reverted to an old Cargo.lock file which I'll stay with for now.

@DDtKey
Copy link
Owner

DDtKey commented Dec 15, 2021

@tl8roy thanks for the info!
Beta versions of actix-web 4 are sometimes backwards incompatible.
This will definitely be fixed for actix-web-grants

After the release of the version, I will additionally report here.

@DDtKey
Copy link
Owner

DDtKey commented Dec 25, 2021

So, first error caused by actix-web changes 2487.
In fact, it upsets me. At the moment, we have only two options:

  1. Give up support of Guard way protection
  2. Work-around approach: use headers instead of extensions. But it seems strange and less optimal, however it works fine (I've tested). It could be moved to the optional feature of actix-web-grants, so that it doesn't affect users who do not use this feature.

Current actix-web documentation of Guard is incorrect. I hope find any comments from core-team after that we will take our direction 🤔

@DDtKey
Copy link
Owner

DDtKey commented Dec 27, 2021

It looks like the first issue will be fixed in the next versions of actix-web (actix/actix-web#2552) 🚀

@DDtKey
Copy link
Owner

DDtKey commented Dec 30, 2021

actix-web-grants 3.0.0-beta.5 has just been released! 🎉
It works with current actix-web: 4.0.0-beta.18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants