Skip to content

fix(server/http): graphql server compliance issues #4507

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

Merged
merged 26 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4483680
fix(server/http): graphql server compliance issues
YassinEldeeb Mar 30, 2023
32c2691
chore: revert back new service instantiation
YassinEldeeb Apr 18, 2023
bdc5b1f
fix: more compliance issues
YassinEldeeb Apr 18, 2023
5068883
chore: cleanup
YassinEldeeb Apr 18, 2023
16fb5f4
chore: remove unused method
YassinEldeeb Apr 18, 2023
4205056
chore: cleanup
YassinEldeeb Apr 18, 2023
9d29145
chore: remove unused import
YassinEldeeb Apr 18, 2023
99037b7
chore: remove unused imports
YassinEldeeb Apr 18, 2023
b5c0f05
chore: remove unused import
YassinEldeeb Apr 18, 2023
5ced62a
ci: fix tests
YassinEldeeb Apr 26, 2023
ca46f00
test: fix failing tests
YassinEldeeb May 12, 2023
7a5d4e6
test: fix broken test
YassinEldeeb May 12, 2023
e403120
tests: fix failing test
YassinEldeeb May 12, 2023
f955013
fix: compliance notices
YassinEldeeb Jun 5, 2023
31a3a1d
chore: underscore unused var
YassinEldeeb Jun 5, 2023
dcb10cd
chore: format
YassinEldeeb Jun 5, 2023
47675cd
test: fix failing
YassinEldeeb Jun 12, 2023
752bfe2
debug tests
YassinEldeeb Jun 12, 2023
845638b
tests: fix failing
YassinEldeeb Jun 12, 2023
48825a1
tests: fix failing
YassinEldeeb Jun 12, 2023
a449ac1
chore: update comment
YassinEldeeb Jul 17, 2023
ed01c1b
add an env var to disable strict compliance
YassinEldeeb Jul 19, 2023
ea0551d
chore: small cleanup
YassinEldeeb Jul 25, 2023
89f77f1
chore: remove unncessary print
YassinEldeeb Jul 25, 2023
8782c76
chore: fix accidently removed line
YassinEldeeb Jul 25, 2023
ea33b55
chore: remove check
YassinEldeeb Jul 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ lcov.info
# Built solidity contracts.
/tests/**/bin
/tests/**/truffle_output

# Docker volumes and debug logs
.postgres
logfile
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
volumes:
- ./data/ipfs:/data/ipfs
postgres:
image: postgres
image: postgres:14
ports:
- '5432:5432'
command:
Expand Down
2 changes: 2 additions & 0 deletions graph/src/data/query/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ impl QueryResults {

pub fn as_http_response<T: From<String>>(&self) -> http::Response<T> {
let status_code = http::StatusCode::OK;

let json =
serde_json::to_string(self).expect("Failed to serialize GraphQL response to JSON");

http::Response::builder()
.status(status_code)
.header(ACCESS_CONTROL_ALLOW_ORIGIN, "*")
Expand Down
11 changes: 7 additions & 4 deletions server/http/src/server.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use std::net::{Ipv4Addr, SocketAddrV4};

use futures::future::Future;
use hyper::service::make_service_fn;
use hyper::Server;
use thiserror::Error;

use crate::service::GraphQLService;
use graph::prelude::{GraphQLServer as GraphQLServerTrait, *};
use thiserror::Error;
use graph::prelude::{GraphQLServer as GraphQLServerTrait, GraphQlRunner, *};

/// Errors that may occur when starting the server.
#[derive(Debug, Error)]
Expand Down Expand Up @@ -66,12 +67,14 @@ where
let graphql_runner = self.graphql_runner.clone();
let node_id = self.node_id.clone();
let new_service = make_service_fn(move |_| {
futures03::future::ok::<_, Error>(GraphQLService::new(
let graphql_service = GraphQLService::new(
logger_for_service.clone(),
graphql_runner.clone(),
ws_port,
node_id.clone(),
))
);

futures03::future::ok::<_, Error>(graphql_service)
});

// Create a task to run the server and handle HTTP requests
Expand Down
Loading