Error: Is Dgraph running locally? or reachable? TypeError: Failed to fetch

I am trying to follow the Dgraph DQL Tour tutorial.
I have done

docker pull dgraph/standalone
docker run -it -p 5080:5080 -p 6080:6080 -p 8080:8080 \
  -p 9080:9080 -p 8000:8000 -v ~/dgraph:/dgraph --name dgraph \
  dgraph/standalone:v21.03.0

at step 2.

However, at step 3 Load Schema | Intro | Dgraph Tour

I got error:

Error: Is Dgraph running locally? or reachable? TypeError: Failed to fetch

Here is my terminal log:

Click to expand
➜ docker run -it -p 5080:5080 -p 6080:6080 -p 8080:8080 \
  -p 9080:9080 -p 8000:8000 -v ~/dgraph:/dgraph --name dgraph \
  dgraph/standalone:v21.03.0

Warning: This standalone version is meant for quickstart purposes only.
         It is NOT RECOMMENDED for production environments.
2021/06/13 17:41:40 Listening on :8000...
[Sentry] 2021/06/13 17:41:40 Integration installed: ContextifyFrames
[Sentry] 2021/06/13 17:41:40 Integration installed: Environment
[Sentry] 2021/06/13 17:41:40 Integration installed: Modules
[Sentry] 2021/06/13 17:41:40 Integration installed: IgnoreErrors
[Sentry] 2021/06/13 17:41:40 Integration installed: ContextifyFrames
[Sentry] 2021/06/13 17:41:40 Integration installed: Environment
[Sentry] 2021/06/13 17:41:40 Integration installed: Modules
[Sentry] 2021/06/13 17:41:40 Integration installed: IgnoreErrors
[Sentry] 2021/06/13 17:41:41 Integration installed: ContextifyFrames
[Sentry] 2021/06/13 17:41:41 Integration installed: Environment
[Sentry] 2021/06/13 17:41:41 Integration installed: Modules
[Sentry] 2021/06/13 17:41:41 Integration installed: IgnoreErrors
[Sentry] 2021/06/13 17:41:41 Integration installed: ContextifyFrames
[Sentry] 2021/06/13 17:41:41 Integration installed: Environment
[Sentry] 2021/06/13 17:41:41 Integration installed: Modules
[Sentry] 2021/06/13 17:41:41 Integration installed: IgnoreErrors
I0613 17:41:41.497898      34 sentry_integration.go:48] This instance of Dgraph will send anonymous reports of panics back to Dgraph Labs via Sentry. No confidential information is sent. These reports help improve Dgraph. To opt-out, restart your instance with the --telemetry "sentry=false;" flag. For more info, see https://dgraph.io/docs/howto/#data-handling.
I0613 17:41:41.508511      42 sentry_integration.go:48] This instance of Dgraph will send anonymous reports of panics back to Dgraph Labs via Sentry. No confidential information is sent. These reports help improve Dgraph. To opt-out, restart your instance with the --telemetry "sentry=false;" flag. For more info, see https://dgraph.io/docs/howto/#data-handling.
I0613 17:41:41.651067      34 init.go:110]

Dgraph version   : v21.03.0
Dgraph codename  : rocket
Dgraph SHA-256   : b4e4c77011e2938e9da197395dbce91d0c6ebb83d383b190f5b70201836a773f
Commit SHA-1     : a77bbe8ae
Commit timestamp : 2021-04-07 21:36:38 +0530
Branch           : HEAD
Go version       : go1.16.2
jemalloc enabled : true

For Dgraph official documentation, visit https://dgraph.io/docs.
For discussions about Dgraph     , visit http://discuss.dgraph.io.
For fully-managed Dgraph Cloud   , visit https://dgraph.io/cloud.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2021 Dgraph Labs, Inc.


I0613 17:41:41.651113      34 run.go:756] x.Config: {PortOffset:0 Limit:normalize-node=10000; mutations-nquad=1000000; query-timeout=0ms; max-retries=-1; mutations=allow; query-edge=1000000; max-pending-queries=10000; disallow-drop=false; txn-abort-after=5m LimitMutationsNquad:1000000 LimitQueryEdge:1000000 BlockClusterWideDrop:false LimitNormalizeNode:10000 QueryTimeout:0s MaxRetries:-1 GraphQL:extensions=true; poll-interval=1s; lambda-url=; introspection=true; debug=false GraphQLDebug:false}
I0613 17:41:41.651173      34 run.go:757] x.WorkerConfig: {TmpDir:t ExportPath:export Trace:jaeger=; datadog=; ratio=0.01 MyAddr: ZeroAddr:[localhost:5080] TLSClientConfig:<nil> TLSServerConfig:<nil> Raft:learner=false; snapshot-after-entries=10000; snapshot-after-duration=30m; pending-proposals=256; idx=; group= Badger:{Dir: ValueDir: SyncWrites:false NumVersionsToKeep:1 ReadOnly:false Logger:0xc000416160 Compression:1 InMemory:false MetricsEnabled:true NumGoroutines:8 MemTableSize:67108864 BaseTableSize:2097152 BaseLevelSize:10485760 LevelSizeMultiplier:10 TableSizeMultiplier:2 MaxLevels:7 VLogPercentile:0 ValueThreshold:1048576 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 BlockCacheSize:697932185 IndexCacheSize:375809638 NumLevelZeroTables:5 NumLevelZeroTablesStall:15 ValueLogFileSize:1073741823 ValueLogMaxEntries:1000000 NumCompactors:4 CompactL0OnClose:false LmaxCompaction:false ZSTDCompressionLevel:0 VerifyValueChecksum:false EncryptionKey:[] EncryptionKeyRotationDuration:240h0m0s BypassLockGuard:false ChecksumVerificationMode:0 DetectConflicts:true NamespaceOffset:-1 managedTxns:false maxBatchCount:0 maxBatchSize:0 maxValueThreshold:0} WhiteListedIPRanges:[{Lower:0.0.0.0 Upper:255.255.255.255}] StrictMutations:false AclEnabled:false HmacSecret:**** AbortOlderThan:5m0s ProposedGroupId:0 StartTime:2021-06-13 17:41:41.142807039 +0000 UTC m=+0.219045097 Ludicrous:enabled=false; concurrency=2000 LudicrousEnabled:false Security:whitelist=0.0.0.0/0; token= EncryptionKey:**** LogRequest:0 HardSync:false Audit:false}
I0613 17:41:41.651243      34 run.go:758] worker.Config: {PostingDir:p WALDir:w MutationsMode:0 AuthToken: HmacSecret:**** AccessJwtTtl:0s RefreshJwtTtl:0s CachePercentage:0,65,35 CacheMb:1024 Audit:<nil> ChangeDataConf:file=; kafka=; sasl_user=; sasl_password=; ca_cert=; client_cert=; client_key=;}
I0613 17:41:41.661004      34 log.go:295] Found file: 1 First Index: 1
I0613 17:41:41.664195      42 init.go:110]

Dgraph version   : v21.03.0
Dgraph codename  : rocket
Dgraph SHA-256   : b4e4c77011e2938e9da197395dbce91d0c6ebb83d383b190f5b70201836a773f
Commit SHA-1     : a77bbe8ae
Commit timestamp : 2021-04-07 21:36:38 +0530
Branch           : HEAD
Go version       : go1.16.2
jemalloc enabled : true

For Dgraph official documentation, visit https://dgraph.io/docs.
For discussions about Dgraph     , visit http://discuss.dgraph.io.
For fully-managed Dgraph Cloud   , visit https://dgraph.io/cloud.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2021 Dgraph Labs, Inc.


I0613 17:41:41.664282      42 run.go:259] Setting Config to: {raft:0xc0000120e0 telemetry:0xc0001161d8 limit:0xc0000120e8 bindall:true portOffset:0 numReplicas:1 peer: w:zw rebalanceInterval:480000000000 tlsClientConfig:<nil> audit:<nil> limiterConfig:0xc00047c1f0}
I0613 17:41:41.664322      42 run.go:145] Setting up grpc listener at: 0.0.0.0:5080
I0613 17:41:41.664522      42 run.go:145] Setting up http listener at: 0.0.0.0:6080
I0613 17:41:41.665293      34 storage.go:125] Init Raft Storage with snap: 0, first: 1, last: 12
I0613 17:41:41.666378      34 server_state.go:141] Opening postings BadgerDB with options: {Dir:p ValueDir:p SyncWrites:false NumVersionsToKeep:2147483647 ReadOnly:false Logger:0x32c8038 Compression:1 InMemory:false MetricsEnabled:true NumGoroutines:8 MemTableSize:67108864 BaseTableSize:2097152 BaseLevelSize:10485760 LevelSizeMultiplier:10 TableSizeMultiplier:2 MaxLevels:7 VLogPercentile:0 ValueThreshold:1048576 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 BlockCacheSize:697932185 IndexCacheSize:375809638 NumLevelZeroTables:5 NumLevelZeroTablesStall:15 ValueLogFileSize:1073741823 ValueLogMaxEntries:1000000 NumCompactors:4 CompactL0OnClose:false LmaxCompaction:false ZSTDCompressionLevel:0 VerifyValueChecksum:false EncryptionKey:[] EncryptionKeyRotationDuration:240h0m0s BypassLockGuard:false ChecksumVerificationMode:0 DetectConflicts:false NamespaceOffset:1 managedTxns:false maxBatchCount:0 maxBatchSize:0 maxValueThreshold:0}
I0613 17:41:41.674629      42 log.go:295] Found file: 1 First Index: 1
I0613 17:41:41.679725      42 storage.go:125] Init Raft Storage with snap: 0, first: 1, last: 16
I0613 17:41:41.679897      42 node.go:152] Setting raft.Config to: &{ID:1 peers:[] learners:[] ElectionTick:20 HeartbeatTick:1 Storage:0xc000090540 Applied:0 MaxSizePerMsg:262144 MaxCommittedSizePerReady:67108864 MaxUncommittedEntriesSize:0 MaxInflightMsgs:256 CheckQuorum:false PreVote:true ReadOnlyOption:0 Logger:0x32c8038 DisableProposalForwarding:false}
I0613 17:41:41.682388      42 node.go:321] Found hardstate: {Term:3 Vote:1 Commit:16 XXX_unrecognized:[]}
I0613 17:41:41.682628      42 node.go:326] Group 0 found 16 entries
I0613 17:41:41.682640      42 raft.go:605] Restarting node for dgraphzero
I0613 17:41:41.682660      42 log.go:34] 1 became follower at term 3
I0613 17:41:41.682669      42 log.go:34] newRaft 1 [peers: [], term: 3, commit: 16, applied: 0, lastindex: 16, lastterm: 3]
I0613 17:41:41.683199      42 run.go:393] Running Dgraph Zero...
I0613 17:41:41.685299      42 node.go:189] Setting conf state to nodes:1
I0613 17:41:41.686544      42 raft.go:966] Done applying conf change at 0x1
I0613 17:41:41.686810      42 pool.go:162] CONNECTING to localhost:7080
W0613 17:41:41.688401      42 pool.go:267] Connection lost with localhost:7080. Error: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:7080: connect: connection refused"
I0613 17:41:41.711990      34 log.go:34] All 1 tables opened in 6ms
I0613 17:41:41.714578      34 log.go:34] Discard stats nextEmptySlot: 0
I0613 17:41:41.714632      34 log.go:34] Set nextTxnTs to 1
I0613 17:41:41.718388      34 log.go:34] Deleting empty file: p/000001.vlog
I0613 17:41:41.730022      34 groups.go:99] Current Raft Id: 0x1
I0613 17:41:41.730156      34 worker.go:111] Worker listening at address: [::]:7080
I0613 17:41:41.730064      34 groups.go:115] Sending member request to Zero: id:1 addr:"localhost:7080"
I0613 17:41:41.731103      34 run.go:568] Bringing up GraphQL HTTP API at 0.0.0.0:8080/graphql
I0613 17:41:41.731138      34 run.go:569] Bringing up GraphQL HTTP admin API at 0.0.0.0:8080/admin
I0613 17:41:41.731229      34 run.go:596] gRPC server started.  Listening on port 9080
I0613 17:41:41.731264      34 run.go:597] HTTP server started.  Listening on port 8080
E0613 17:41:41.731641      34 groups.go:1177] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": Unable to find any servers for group: 1. closer err: <nil>
I0613 17:41:41.831055      34 pool.go:162] CONNECTING to localhost:5080
I0613 17:41:41.833383      42 zero.go:442] Got connection request: cluster_info_only:true
I0613 17:41:41.833594      42 log.go:34] 1 no leader at term 3; dropping index reading msg
E0613 17:41:42.732066      34 groups.go:1177] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": Unable to find any servers for group: 1. closer err: <nil>
E0613 17:41:43.732644      34 groups.go:1177] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": Unable to find any servers for group: 1. closer err: <nil>
W0613 17:41:43.833975      42 node.go:680] [0x1] Read index context timed out
I0613 17:41:43.834035      42 log.go:34] 1 no leader at term 3; dropping index reading msg
E0613 17:41:44.733186      34 groups.go:1177] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": Unable to find any servers for group: 1. closer err: <nil>
I0613 17:41:44.982869      42 log.go:34] 1 is starting a new election at term 3
I0613 17:41:44.982927      42 log.go:34] 1 became pre-candidate at term 3
I0613 17:41:44.982932      42 log.go:34] 1 received MsgPreVoteResp from 1 at term 3
I0613 17:41:44.982959      42 log.go:34] 1 became candidate at term 4
I0613 17:41:44.983002      42 log.go:34] 1 received MsgVoteResp from 1 at term 4
I0613 17:41:44.983038      42 log.go:34] 1 became leader at term 4
I0613 17:41:44.983054      42 log.go:34] raft.node: 1 elected leader 1 at term 4
I0613 17:41:44.983107      42 raft.go:912] I've become the leader, updating leases.
I0613 17:41:44.983139      42 assign.go:47] Updated UID: 1. Txn Ts: 20001. NsID: 1.
E0613 17:41:45.733878      34 groups.go:1177] Error during SubscribeForUpdates for prefix "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15dgraph.graphql.schema\x00": Unable to find any servers for group: 1. closer err: <nil>
W0613 17:41:45.834146      42 node.go:680] [0x1] Read index context timed out
I0613 17:41:45.834673      42 zero.go:467] Connected: cluster_info_only:true
I0613 17:41:45.835714      42 zero.go:442] Got connection request: id:1 addr:"localhost:7080"
I0613 17:41:45.835925      42 zero.go:589] Connected: id:1 addr:"localhost:7080"
I0613 17:41:45.836371      34 groups.go:134] Connected to group zero. Assigned group: 0
I0613 17:41:45.836416      34 groups.go:136] Raft Id after connection to Zero: 0x1
I0613 17:41:45.836439      34 draft.go:232] Node ID: 0x1 with GroupID: 1
I0613 17:41:45.836504      34 draft.go:241] RaftContext: id:1 group:1 addr:"localhost:7080"
I0613 17:41:45.836645      34 node.go:152] Setting raft.Config to: &{ID:1 peers:[] learners:[] ElectionTick:20 HeartbeatTick:1 Storage:0xc0000904c0 Applied:0 MaxSizePerMsg:262144 MaxCommittedSizePerReady:67108864 MaxUncommittedEntriesSize:0 MaxInflightMsgs:256 CheckQuorum:false PreVote:true ReadOnlyOption:0 Logger:0x32c8038 DisableProposalForwarding:false}
I0613 17:41:45.837124      34 node.go:321] Found hardstate: {Term:3 Vote:1 Commit:12 XXX_unrecognized:[]}
I0613 17:41:45.837183      34 node.go:326] Group 1 found 12 entries
I0613 17:41:45.837189      34 draft.go:1764] Restarting node for group: 1
I0613 17:41:45.837201      34 log.go:34] 1 became follower at term 3
I0613 17:41:45.837206      34 log.go:34] newRaft 1 [peers: [], term: 3, commit: 12, applied: 0, lastindex: 12, lastterm: 3]
I0613 17:41:45.837222      34 draft.go:180] Operation started with id: opRollup
I0613 17:41:45.837333      34 draft.go:1146] Found Raft progress: 0
I0613 17:41:45.837437      34 groups.go:816] Got address of a Zero leader: localhost:5080
I0613 17:41:45.837556      34 groups.go:830] Starting a new membership stream receive from localhost:5080.
I0613 17:41:45.837649      34 node.go:189] Setting conf state to nodes:1
I0613 17:41:45.839441      34 groups.go:847] Received first state update from Zero: counter:18 groups:<key:1 value:<members:<key:1 value:<id:1 group_id:1 addr:"localhost:7080" last_update:1623606105 > > tablets:<key:"\000\000\000\000\000\000\000\000dgraph.drop.op" value:<group_id:1 predicate:"\000\000\000\000\000\000\000\000dgraph.drop.op" > > tablets:<key:"\000\000\000\000\000\000\000\000dgraph.graphql.p_query" value:<group_id:1 predicate:"\000\000\000\000\000\000\000\000dgraph.graphql.p_query" > > tablets:<key:"\000\000\000\000\000\000\000\000dgraph.graphql.schema" value:<group_id:1 predicate:"\000\000\000\000\000\000\000\000dgraph.graphql.schema" > > tablets:<key:"\000\000\000\000\000\000\000\000dgraph.graphql.xid" value:<group_id:1 predicate:"\000\000\000\000\000\000\000\000dgraph.graphql.xid" > > tablets:<key:"\000\000\000\000\000\000\000\000dgraph.type" value:<group_id:1 predicate:"\000\000\000\000\000\000\000\000dgraph.type" > > checksum:12696972231616318625 > > zeros:<key:1 value:<id:1 addr:"localhost:5080" leader:true > > maxTxnTs:20000 maxRaftId:1 cid:"bdfc47a2-656e-43a5-8feb-26752ab27d13" license:<maxNodes:18446744073709551615 expiryTs:1626194106 enabled:true >
I0613 17:41:46.732272      34 admin.go:824] Error reading GraphQL schema: Please retry again, server is not ready to accept requests.
I0613 17:41:46.734741      34 pool.go:162] CONNECTING to localhost:7080
I0613 17:41:46.839167      34 groups.go:166] Server is ready
I0613 17:41:46.839214      34 access_ee.go:408] ResetAcl closed
I0613 17:41:46.839218      34 access_ee.go:318] RefreshAcls closed
I0613 17:41:48.437798      34 log.go:34] 1 is starting a new election at term 3
I0613 17:41:48.437968      34 log.go:34] 1 became pre-candidate at term 3
I0613 17:41:48.438069      34 log.go:34] 1 received MsgPreVoteResp from 1 at term 3
I0613 17:41:48.438097      34 log.go:34] 1 became candidate at term 4
I0613 17:41:48.438168      34 log.go:34] 1 received MsgVoteResp from 1 at term 4
I0613 17:41:48.438202      34 log.go:34] 1 became leader at term 4
I0613 17:41:48.438234      34 log.go:34] raft.node: 1 elected leader 1 at term 4
I0613 17:41:48.838373      34 groups.go:902] Leader idx=0x1 of group=1 is connecting to Zero for txn updates
I0613 17:41:48.838547      34 groups.go:914] Got Zero leader: localhost:5080
I0613 17:41:51.734728      34 admin.go:835] No GraphQL schema in Dgraph; serving empty GraphQL API
I0613 17:42:41.640147      42 raft.go:780] Skipping creating a snapshot. Num groups: 1, Num checkpoints: 0
I0613 17:43:41.595911      42 raft.go:780] Skipping creating a snapshot. Num groups: 1, Num checkpoints: 0
I0613 17:44:41.551936      42 raft.go:780] Skipping creating a snapshot. Num groups: 1, Num checkpoints: 0
I0613 17:45:41.509160      42 raft.go:780] Skipping creating a snapshot. Num groups: 1, Num checkpoints: 0

Did I miss anything? Thanks

The Tour is behind HTTPS, Chrome will block any attempt to connect to Non-HTTPS connections. You may add HTTPS to your local instance with Let’s Encrypt or something.

Thanks @MichelDiz , any guide for doing this?
(Feels this might worth to be added in the tour, because most people will meet this issue)

You can use Traefik, it is simple to do. I was about to create an example for this, but there was no demand until now.

PS. BTW, you can clone the Tour Repo and run it locally. So no HTTPS is involved.

Finally got time to test again. Thanks @MichelDiz !

I got the idea when I try solve another similar issue at “Failed to fetch” when add a localhost server in Dgraph Ratel Dashboard - #2 by Hongbo-Miao

In the end, I succeed

  • Chrome 92.0.4515.107
  • Firefox 92.0a1

and failed for

  • Brave 1.29.16
  • Safari 14.1.1

I guess Brave and Safari are expecting https.
Hope it can help some future people! :grinning:

It is related to this Ratel and Chrome issue

1 Like