Skip to content

Commit

Permalink
fix: better error messages if graphql tried to run with csv only
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstevens19 committed Jul 14, 2024
1 parent 6fb9591 commit 6befb7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
33 changes: 19 additions & 14 deletions core/src/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,26 @@ pub async fn start_rindexer(details: StartDetails<'_>) -> Result<(), StartRindex
}

// Spawn a separate task for the GraphQL server if specified
let graphql_server_handle = if details.graphql_details.enabled {
let manifest_clone = Arc::clone(&manifest);
let indexer = manifest_clone.to_indexer();
let mut graphql_settings = manifest.graphql.clone().unwrap_or_default();
if let Some(override_port) = &details.graphql_details.override_port {
graphql_settings.set_port(*override_port);
}
Some(tokio::spawn(async move {
if let Err(e) = start_graphql_server(&indexer, &graphql_settings).await {
error!("Failed to start GraphQL server: {:?}", e);
let graphql_server_handle =
if details.graphql_details.enabled && manifest.storage.postgres_enabled() {
let manifest_clone = Arc::clone(&manifest);
let indexer = manifest_clone.to_indexer();
let mut graphql_settings = manifest.graphql.clone().unwrap_or_default();
if let Some(override_port) = &details.graphql_details.override_port {
graphql_settings.set_port(*override_port);
}
}))
} else {
None
};
Some(tokio::spawn(async move {
if let Err(e) = start_graphql_server(&indexer, &graphql_settings).await {
error!("Failed to start GraphQL server: {:?}", e);
}
}))
} else {
None
};

if graphql_server_handle.is_none() && details.graphql_details.enabled {
error!("GraphQL can not run without postgres storage enabled, you have tried to run GraphQL which will now be skipped.");
}

if let Some(mut indexing_details) = details.indexing_details {
let postgres_enabled = &manifest.storage.postgres_enabled();
Expand Down
2 changes: 1 addition & 1 deletion documentation/docs/pages/docs/start-building/running.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You will need to make sure you have docker running on your machine before starti
You can also run docker manually by using `docker compose up -d`.
:::

:::info
:::warn
graphql API can only be ran when you have a postgres storage setup in your YAML.
:::

Expand Down

0 comments on commit 6befb7d

Please sign in to comment.