Skip to content

[Bug]: Go searcher gateway sample is missing initial subscribe() call (Atlas SVR onboarding) #3763

@QingyangKong

Description

@QingyangKong

Describe the bug

In the Atlas SVR searcher onboarding guide, the Go sample for runSearcherGateway defines a subscribe closure but never calls it before entering the main loop.

As written, when the main loop runs:

for {
    select {
    case <-sub.Err():
        // ...
    case n := <-uoChan:
        // ...
    }
}

both sub and uoChan are still their zero values (nil). Reading from a nil *rpc.ClientSubscription via <-sub.Err() will panic with a nil pointer dereference, and uoChan is nil so no notifications are ever received. The searcher gateway example therefore cannot work as-is.

The fix is to invoke subscribe() once before the for { select { … } } loop so the initial subscription is established.

To Reproduce

  1. Go to https://docs.chain.link/data-feeds/svr-feeds/searcher-onboarding-atlas
  2. Scroll to the searcher gateway Go sample (connect.go, runSearcherGateway)
  3. Use the sample in a Go project and run it
  4. Observe: the program either panics on <-sub.Err() (nil pointer dereference), or hangs forever and never receives any user-operation notifications because the subscription was never started

URLs

Expected behavior

The sample should call subscribe() once after defining the closure and before entering the main for { select { … } } loop, so that sub and uoChan are properly initialized. For example:

subscribe := func() { /* ... */ }

subscribe() // <-- initial subscription, currently missing in the docs

for {
    select {
    case <-sub.Err():
        subscribe()
    case n := <-uoChan:
        // ...
    }
}

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriage

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions