Я использую движок Hasura GraphQL с использованием контейнера Docker и подключаюсь к существующей базе данных Postgres точно так же.
#! /bin/bash
docker run --rm -p 8080:8080 \
-e HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:postgres@hostname:5432/DB \
-e HASURA_GRAPHQL_ENABLE_CONSOLE=true \
hasura/graphql-engine:latest
Затем я пытаюсь экспортировать схему Hasura GraphQL и получаю ошибка.
gq http://localhost:8080/v1/graphql --introspect > schema.graphql
Executing query... error
Error: { Error: Network error: request to http://localhost:8080/v1/graphql failed, reason: read ECONNRESET
at new ApolloError (/Users/xxx/.nodebrew/node/v10.16.0/lib/node_modules/graphqurl/node_modules/apollo-client/bundle.umd.js:92:26)
at /Users/xxx/.nodebrew/node/v10.16.0/lib/node_modules/graphqurl/node_modules/apollo-client/bundle.umd.js:1588:34
at /Users/xxx/.nodebrew/node/v10.16.0/lib/node_modules/graphqurl/node_modules/apollo-client/bundle.umd.js:2008:15
at Set.forEach (<anonymous>)
at /Users/xxx/.nodebrew/node/v10.16.0/lib/node_modules/graphqurl/node_modules/apollo-client/bundle.umd.js:2006:26
at Map.forEach (<anonymous>)
at QueryManager.broadcastQueries (/Users/xxx/.nodebrew/node/v10.16.0/lib/node_modules/graphqurl/node_modules/apollo-client/bundle.umd.js:2004:20)
at /Users/xxx/.nodebrew/node/v10.16.0/lib/node_modules/graphqurl/node_modules/apollo-client/bundle.umd.js:1483:29
at process._tickCallback (internal/process/next_tick.js:68:7)
graphQLErrors: [],
networkError:
{ FetchError: request to http://localhost:8080/v1/graphql failed, reason: read ECONNRESET
at ClientRequest.<anonymous> (/Users/xxx/.nodebrew/node/v10.16.0/lib/node_modules/graphqurl/node_modules/node-fetch/lib/index.js:1455:11)
at ClientRequest.emit (events.js:198:13)
at Socket.socketErrorListener (_http_client.js:392:9)
at Socket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
message:
'request to http://localhost:8080/v1/graphql failed, reason: read ECONNRESET',
type: 'system',
errno: 'ECONNRESET',
code: 'ECONNRESET' },
message:
'Network error: request to http://localhost:8080/v1/graphql failed, reason: read ECONNRESET',
extraInfo: undefined }
Журналы запуска Hasura.
{"type":"startup","timestamp":"2020-04-20T01:12:58.195+0000","level":"info","detail":{"kind":"server_configuration","info":{"live_query_options":{"batch_size":100,"refetch_delay":1},"transaction_isolation":"ISOLATION LEVEL READ COMMITTED","plan_cache_options":{"plan_cache_size":null},"enabled_log_types":["http-log","websocket-log","startup","webhook-log"],"server_host":"HostAny","enable_allowlist":false,"log_level":"info","auth_hook_mode":null,"use_prepared_statements":true,"unauth_role":null,"stringify_numeric_types":false,"enabled_apis":["metadata","graphql","config","pgdump"],"enable_telemetry":true,"enable_console":true,"auth_hook":null,"jwt_secret":null,"cors_config":{"allowed_origins":"*","disabled":false,"ws_read_cookie":null},"console_assets_dir":null,"admin_secret_set":false,"port":8080}}}
{"type":"startup","timestamp":"2020-04-20T01:12:58.195+0000","level":"info","detail":{"kind":"postgres_connection","info":{"retries":1,"database_url":"postgres://postgres:...@hostname:5432/DB"}}}
{"type":"startup","timestamp":"2020-04-20T01:12:59.372+0000","level":"info","detail":{"kind":"db_migrate","info":"Already at the latest catalog version (31); nothing to do."}}
{"type":"startup","timestamp":"2020-04-20T01:12:59.372+0000","level":"info","detail":{"kind":"schema-sync","info":{"thread_id":"ThreadId 21","instance_id":"6cf6681e-e6a7-4984-9ee8-0c547897596c","message":"listener thread started"}}}
{"type":"startup","timestamp":"2020-04-20T01:12:59.372+0000","level":"info","detail":{"kind":"schema-sync","info":{"thread_id":"ThreadId 22","instance_id":"6cf6681e-e6a7-4984-9ee8-0c547897596c","message":"processor thread started"}}}
{"type":"startup","timestamp":"2020-04-20T01:12:59.372+0000","level":"info","detail":{"kind":"event_triggers","info":"preparing data"}}
{"type":"startup","timestamp":"2020-04-20T01:13:00.373+0000","level":"info","detail":{"kind":"event_triggers","info":"starting workers"}}
{"type":"startup","timestamp":"2020-04-20T01:13:00.373+0000","level":"info","detail":{"kind":"telemetry","info":"Help us improve Hasura! The graphql-engine server collects anonymized usage stats which allows us to keep improving Hasura at warp speed. To read more or opt-out, visit https://docs.hasura.io/1.0/graphql/manual/guides/telemetry.html"}}
{"type":"startup","timestamp":"2020-04-20T01:13:00.373+0000","level":"info","detail":{"kind":"server","info":{"time_taken":2.2313416,"message":"starting API server"}}}
Кто-нибудь знает почему?