Closed adaptive-alexander closed 1 year ago
@adaptive-alexander have you tried running cargo clean
and recompiling?
@adaptive-alexander we've hit it recently too. This is not related to juniper
. For me, it happens when CLion tries to auto-build the project, and then I try to build it from shell.
Anyway, if this won't help, you may exclude graphql-parser
(and so, thiserror
) by disabling default features (it seems that your code doesn't use schema-language
feature anyway):
juniper = { version = "0.15.10", features = ["uuid", "chrono"], default-features = false }
Cargo clean was indeed enough to fix the problem. I did try removing cargo registry and also built from two different computers with same result. That along with the error message lead me to believe something had broken in the dependency. Thanks a lot for the help! Builds as expected.
Describe the bug When trying to build the backend for an API I get the following error:
error[E0554]:
#![feature]
may not be used on the stable release channel --> C:\Users\alexa.cargo\registry\src\github.com-1ecc6299db9ec823\thiserror-1.0.37\src\lib.rs:238:34 | 238 | #![cfg_attr(provide_any, feature(provide_any))] | ^^^^^^^^^^^For more information about this error, try
rustc --explain E0554
.error: could not compile
thiserror
due to previous errorJuniper is the only crate in the build using the thiserror crate.
Excerpt from cargo tree: │ ├── graphql-parser v0.3.0 │ │ ├── combine v3.8.1 │ │ │ ├── ascii v0.9.3 │ │ │ ├── byteorder v1.4.3 │ │ │ ├── either v1.8.0 │ │ │ ├── memchr v2.5.0 │ │ │ └── unreachable v1.0.0 │ │ │ └── void v1.0.2 │ │ └── thiserror v1.0.37 │ │ └── thiserror-impl v1.0.37 (proc-macro) │ │ ├── proc-macro2 v1.0.47 () │ │ ├── quote v1.0.21 () │ │ └── syn v1.0.103 (*)
To Reproduce Steps to reproduce the behavior:
juniper = { version = "0.15.10", features = ["uuid", "chrono"] }
use juniper::http::{graphiql::graphiql_source, GraphQLRequest}; use deadpool_postgres::{Config, ManagerConfig, RecyclingMethod, Runtime}; use tokio_postgres::NoTls; use std::env;
pub type Pool = deadpool_postgres::Pool;
/// Create database pool to use in Juniper Context pub fn get_db_pool(port: u16) -> Pool { // Initializing database connection config let mut cfg = Config::new(); cfg.dbname = Some(env::var("POSTGRES_DB").unwrap()); cfg.host = Some("postgres".to_string()); cfg.port = Some(port); cfg.user = Some(env::var("POSTGRES_USER").unwrap()); cfg.password = Some(env::var("POSTGRES_PASSWORD").unwrap()); cfg.manager = Some(ManagerConfig { recycling_method: RecyclingMethod::Fast, }); cfg.create_pool(Some(Runtime::Tokio1), NoTls).unwrap() }
/// GraphiQL UI
[get("/graphiql")]
async fn graphql_playground() -> impl Responder { Html(graphiql_source("/graphql", None)) }
/// GraphQL endpoint
[route("/graphql", method = "GET", method = "POST")]
pub async fn graphql( pool: web::Data,
schema: web::Data,
data: web::Json,
) -> Result<HttpResponse, Error> {
let ctx = Context {
db_pool: pool.get_ref().to_owned(),
};
}
Expected behavior To build, not sure if there's anything more to add.
Additional context GraphQL API, postgres, actix. Has previously worked, is up in production (docker, kubernetes) but will not build for me now. Tried on two different computers and in two different repos.