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
- Go to https://docs.chain.link/data-feeds/svr-feeds/searcher-onboarding-atlas
- Scroll to the searcher gateway Go sample (connect.go, runSearcherGateway)
- Use the sample in a Go project and run it
- 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
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:
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
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:
Additional context
No response