diff --git a/core/web/resolver/chain_test.go b/core/web/resolver/chain_test.go index b172047d865..b7a4b7c8386 100644 --- a/core/web/resolver/chain_test.go +++ b/core/web/resolver/chain_test.go @@ -108,6 +108,25 @@ ResendAfterThreshold = '1h0m0s' } }`, configTOMLEscaped), }, + unauthorizedTestCase(GQLTestCase{query: query}, "chains"), + { + name: "no chains", + authenticated: true, + before: func(f *gqlTestFramework) { + f.App.On("GetRelayers").Return(&chainlinkmocks.FakeRelayerChainInteroperators{Relayers: []loop.Relayer{}}) + + }, + query: query, + result: ` + { + "chains": { + "results": [], + "metadata": { + "total": 0 + } + } + }`, + }, } RunGQLTests(t, testCases) diff --git a/core/web/resolver/query.go b/core/web/resolver/query.go index 90975777f97..ccc9da2ab91 100644 --- a/core/web/resolver/query.go +++ b/core/web/resolver/query.go @@ -105,6 +105,11 @@ func (r *Resolver) Chains(ctx context.Context, args struct { } count := len(chains) + if count == 0 { + //No chains are configured, return an empty ChainsPayload, so we don't break the UI + return NewChainsPayload(nil, 0), nil + } + // bound the chain results if offset >= len(chains) { return nil, fmt.Errorf("offset %d out of range", offset)