Prerequisites
Describe the bug
When the query type is not Query, the config passes tc check but server fails to startup panicking with SchemaError.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SchemaError("Type \"Que\" not found")', src/blueprint/blueprint.rs:211:21
Steps to reproduce
- Use the following config. Note that
Que is defined:
schema
# Specify server configuration: Start tailcall server at 0.0.0.0:8000 and enable GraphiQL playground
@server(port: 8000, enableGraphiql: true, enableResponseValidation: true, hostname: "0.0.0.0")
# Specify a base url for all http requests
@upstream(baseURL: "http://jsonplaceholder.typicode.com") {
query: Que
}
type Que {
# Specify the http path for the users query
posts: [Post] @const( data: [{id: 1}])
}
# Create a post type with the fields returned by the posts api
type Post {
id: Int!
title: String
body: String
}
- Run
cargo run -- check [file-path] -> It passes
- Run
cargo run -- start [file-path] -> Server fails to start
Expected behavior
Server starts normally.
Actual behavior
Server failed to start because of a panic at Err value.
Environment information:
- Operating System: macOS Sonoma
- Tailcall Version:
main branch
- Rust Version: 1.70.0
- GraphQL Client/version: N/A
Additional context
The error is returned by the async_graphql dependency while building the SchemaBuilder.
Logs
stack backtrace:
0: rust_begin_unwind
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
1: core::panicking::panic_fmt
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
2: core::result::unwrap_failed
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1687:5
3: core::result::Result<T,E>::unwrap
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1089:23
4: tailcall::blueprint::blueprint::Blueprint::to_schema
at ./src/blueprint/blueprint.rs:211:5
5: tailcall::http::server_context::ServerContext::new
at ./src/http/server_context.rs:42:18
6: tailcall::http::server::start_server::{{closure}}
at ./src/http/server.rs:128:24
7: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
at /Users/anuraag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/park.rs:282:63
8: tokio::runtime::coop::with_budget
at /Users/anuraag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/coop.rs:107:5
9: tokio::runtime::coop::budget
at /Users/anuraag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/coop.rs:73:5
10: tokio::runtime::park::CachedParkThread::block_on
at /Users/anuraag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/park.rs:282:31
11: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
at /Users/anuraag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/context/blocking.rs:66:9
12: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
at /Users/anuraag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/scheduler/multi_thread/mod.rs:87:13
13: tokio::runtime::context::runtime::enter_runtime
at /Users/anuraag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/context/runtime.rs:65:16
14: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
at /Users/anuraag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/scheduler/multi_thread/mod.rs:86:9
15: tokio::runtime::runtime::Runtime::block_on
at /Users/anuraag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.34.0/src/runtime/runtime.rs:350:45
16: tailcall::cli::tc::run
at ./src/cli/tc.rs:33:7
17: tailcall::main
at ./src/main.rs:12:16
18: core::ops::function::FnOnce::call_once
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:250:5
Prerequisites
Describe the bug
When the query type is not
Query, the config passestc checkbut server fails to startup panicking with SchemaError.Steps to reproduce
Queis defined:cargo run -- check [file-path]-> It passescargo run -- start [file-path]-> Server fails to startExpected behavior
Server starts normally.
Actual behavior
Server failed to start because of a panic at Err value.
Environment information:
mainbranchAdditional context
The error is returned by the
async_graphqldependency while building theSchemaBuilder.Logs