blockscout / blockscout-rs

Microservices for blockscout indexer
MIT License
158 stars 116 forks source link

Error "sgd12.domain does not exist" when querying data from BENS #813

Open johnny-vu opened 7 months ago

johnny-vu commented 7 months ago

I got this error "sgd12.domain" does not exist when I trying to query data from BENS: https://bns.pulse.domains/api/v1/369/domains/kaito.pls

Here is the logs:

Mar 27 18:24:00 ip-172-31-16-254 bens-server[25976]: 2024-03-27T18:24:00.820032Z  INFO HTTP request{method=GET endpoint=/api/v1/{chain_id}/domains/{name} client_ip=149.154.161.214 request_id=709e5c7c-6587-4958-98db-9b27b20984fe}:get_domain{domain_name=DomainName { id: "0xdb5c3ace0a3eafd6eca3ba37f76cd3cfe03c51faf2d51c80fa32d07ae3852413", label_name: "kaito", name: "kaito.pls" } schema="sgd12" input=GetDomainInput { network_id: 369, name: "kaito.pls", only_active: false }}: bens_logic::subgraphs_reader::sql::domain: new
Mar 27 18:24:00 ip-172-31-16-254 bens-server[25976]: 2024-03-27T18:24:00.820637Z ERROR HTTP request{method=GET endpoint=/api/v1/{chain_id}/domains/{name} client_ip=149.154.161.214 request_id=709e5c7c-6587-4958-98db-9b27b20984fe}:get_domain{domain_name=DomainName { id: "0xdb5c3ace0a3eafd6eca3ba37f76cd3cfe03c51faf2d51c80fa32d07ae3852413", label_name: "kaito", name: "kaito.pls" } schema="sgd12" input=GetDomainInput { network_id: 369, name: "kaito.pls", only_active: false }}: bens_logic::subgraphs_reader::sql::domain: error=Db err
Mar 27 18:24:00 ip-172-31-16-254 bens-server[25976]: 2024-03-27T18:24:00.820669Z  INFO HTTP request{method=GET endpoint=/api/v1/{chain_id}/domains/{name} client_ip=149.154.161.214 request_id=709e5c7c-6587-4958-98db-9b27b20984fe}:get_domain{domain_name=DomainName { id: "0xdb5c3ace0a3eafd6eca3ba37f76cd3cfe03c51faf2d51c80fa32d07ae3852413", label_name: "kaito", name: "kaito.pls" } schema="sgd12" input=GetDomainInput { network_id: 369, name: "kaito.pls", only_active: false }}: bens_logic::subgraphs_reader::sql::domain: close time.busy=180µs time.idle=456µs
Mar 27 18:24:00 ip-172-31-16-254 bens-server[25976]: 2024-03-27T18:24:00.820685Z ERROR HTTP request{method=GET endpoint=/api/v1/{chain_id}/domains/{name} client_ip=149.154.161.214 request_id=709e5c7c-6587-4958-98db-9b27b20984fe}: bens_server::services::domain_extractor: error during request handle err=DbErr(Database(PgDatabaseError { severity: Error, code: "42P01", message: "relation \"sgd12.domain\" does not exist", detail: None, hint: None, position: Some(Original(521)), where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some("parse_relation.c"), line: Some(1371), routine: Some("parserOpenTable") }))
Mar 27 18:24:00 ip-172-31-16-254 bens-server[25976]: 2024-03-27T18:24:00.820730Z  INFO HTTP request{method=GET endpoint=/api/v1/{chain_id}/domains/{name} client_ip=149.154.161.214 request_id=709e5c7c-6587-4958-98db-9b27b20984fe duration=762 unit="microsecond" exception.message=Internal error: internal error exception.details=Error { code: Internal, message: "internal error" }}: blockscout_tracing_actix_web::middleware: Finished HTTP request processing

Does it matter if my graph-node has more than one subgraph? In fact, it has 2 subgraphs: one for forked ENS (graphprotocol/pns) and one for blocks indexing (pcl/blocks)

Here is the log when it starts launching:

2024-03-27T18:08:11.268602Z  INFO bens_server::server: found networks from config: {369: NetworkInfo { blockscout_client: BlockscoutClient { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("scan.mypinata.cloud")), port: None, path: "/ipfs/bafybeidn64pd2u525lmoipjl4nh3ooa2imd7huionjsdepdsphl5slfowy/", query: None, fragment: Some("") }, inner: ClientWithMiddleware { inner: Client { accepts: Accepts, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*"}, timeout: 30s }, .. }, max_concurrent_requests: 5 }, subgraph_configs: {"graphprotocol/pns": SubgraphSettings { use_cache: true, address_resolve_technique: ReverseRegistry, empty_label_hash: None, native_token_contract: Some(0x65cf7f7aa5a4a2c20120b445ca4f05f63e2628c4) }} }}
2024-03-27T18:08:11.272905Z  INFO bens_logic::subgraphs_reader::reader: found subgraph deployments deployments={369: [Deployment { subgraph_name: "pcl/blocks", schema_name: "sgd12", net_version: 369 }, Deployment { subgraph_name: "graphprotocol/pns", schema_name: "sgd14", net_version: 369 }]}
2024-03-27T18:08:11.272949Z  WARN bens_logic::subgraphs_reader::reader: no settings found for subgraph 'pcl/blocks', use default
2024-03-27T18:08:12.234036Z  INFO bens_logic::subgraphs_reader::reader: initialized subgraph reader networks=[369]
2024-03-27T18:08:12.234330Z  INFO tokio_cron_scheduler::job_scheduler: Uninited
2024-03-27T18:08:12.234395Z  INFO tokio_cron_scheduler::job_scheduler: Job creator created
2024-03-27T18:08:12.234466Z  INFO blockscout_service_launcher::launcher::launch: starting http server on addr 0.0.0.0:8050
2024-03-27T18:08:12.234653Z  INFO actix_server::builder: starting 4 workers
2024-03-27T18:08:12.234700Z  INFO actix_server::server: Tokio runtime found; starting in existing Tokio runtime

I think it should be access to sgd14.domain but not sure why it still use sgd12.domain. Anyone can help to fix?

sevenzing commented 7 months ago

On the start BENS tries to guess subgraph schema in Postgres and chooses the oldest one for every subgraph. I guess you redeployed your subgraph and therefore now you have multiple schemas. However since your schema isn’t available (I can see it in BENS error) I think you can just restart BENS server and it will choose correct schema

sevenzing commented 7 months ago

oh, I see. Did I understand correctly that you want to connect BENS to graphprotocol/pns but you have two subgraphs with the same chain_id and BENS chooses wrong subgraph instead of graphprotocol/pns ?

johnny-vu commented 7 months ago

@sevenzing yes, you're right. I think it choose wrong subgraph

sevenzing commented 7 months ago

well, I guess this is a bug then. We didn't use several subgraphs with same chain_id in producation during our bens v1 stage, so we didnt face this problem.

I guess solution here is to change code a liitle bit:

sevenzing commented 7 months ago

if you want you can try to make PR that will fix this 😺 if not, then I will fix it next week or later 😿