Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sourcegraph] Self-hosted sourcegraph search doesn't work #1126

Closed
dleen opened this issue Mar 17, 2022 · 10 comments · Fixed by #1228
Closed

[Sourcegraph] Self-hosted sourcegraph search doesn't work #1126

dleen opened this issue Mar 17, 2022 · 10 comments · Fixed by #1228
Labels
bug Something isn't working extension Issues related to one of the extensions in the Store

Comments

@dleen
Copy link

dleen commented Mar 17, 2022

Extension – Sourcegraph

Author: @bobheadxi

Description

Searching using self-hosted url doesn't work.

Error:

Error: Protocol error

__node_internal_captureLargerStackTrace:errors:464:5
NghttpError:util:555:5
Http2Session.onSessionInternalError:core:784:26

Steps To Reproduce

  1. Configure self-hosted sourcegraph address e.g. https://sourcegraph.mydomain.net, enter API key
  2. Do a search

The current behavior

The search doesn't work...

Screen Shot 2022-03-16 at 9 44 54 PM

The expected behavior

The search results are shown

Raycast version

Version: 1.30.3

@dleen dleen added bug Something isn't working extension Issues related to one of the extensions in the Store labels Mar 17, 2022
@bobheadxi
Copy link
Contributor

@dleen What version of Sourcegraph is your self-hosted Sourcegraph instance?

@dleen
Copy link
Author

dleen commented Mar 17, 2022

Good question, sorry I should have included it: 3.37.0

@bobheadxi
Copy link
Contributor

bobheadxi commented Mar 18, 2022

No worries! Is your instance hosted behind networking restrictions of any kind? I use Sourcegraph's internal self-hosted instance regularly, and am unable to reproduce your issue:

image

@dleen
Copy link
Author

dleen commented Mar 18, 2022

Yes, my sourcegraph instance is only available via a VPN. But I made sure the VPN was connected, I can access the instance fine via browser, and via curl.

I think I'll check out the extension and run it locally with some debug statements to see what's happening...

@bobheadxi
Copy link
Contributor

I did some brief searches regarding this. Threads like this one indicate that we might need to introduce additional configuration to connect to VPNs, but I'm not terribly familiar with VPNs in general so I'm not too sure where to start.

If you could share a more complete error message, or some details about your VPN setup, that might be helpful!

@dleen
Copy link
Author

dleen commented Mar 27, 2022

I got around to looking at this.

If you could share a more complete error message, or some details about your VPN setup, that might be helpful!

Unfortunately that error message is the entire message. Nothing else shows up. I don't think the VPN setup is the problem because I am able to reach the instance using all other clients just fine e.g. the sourcegraph curl instructions work.

I installed the extension locally but it didn't give any extra error details. The error said Error: Protocol error so when I took a look at the code I did notice that it was using EventSource and http2:

import EventSource from "@bobheadxi/node-eventsource-http2"

I took a look at the library and saw that it was a fork because the original didn't support http2. I swapped out the EventSource library for:

import EventSource from 'eventsource'

which actually worked and returned results from the server.

This ran into its own problem where it never stopped (requesting?) returning results until it hit a memory limit:

Error: Worker terminated due to reaching memory limit: JS heap out of memory

__node_internal_captureLargerStackTrace:errors:464:5
NodeError:errors:371:5
Worker.[kOnExit]:worker:279:26
Worker.<computed>.onexit:worker:201:20

Maybe that's an issue with the library being different from the fork and some code needs updating to stop returning results?

But it was good to make some progress.

I'm not sure why the http2 library didn't work or what the protocol error actually means. When I visit my sourcegraph instance in the browser and inspect the network requests I see some h2 requests (although just for JS assets, not the actual API queries).

@bobheadxi
Copy link
Contributor

bobheadxi commented Mar 27, 2022

Interesting, I tried eventsource when first creating the extension and I couldn't get it to work. I see they cut a new release recently (https://github.com/EventSource/eventsource/releases/tag/v2.0.0), and I am indeed able to get it to work now - I'm not sure if something changed in the library or on our end 🤔

I saw the memory limit issue as well and I think I've fixed it with bobheadxi/raycast-sourcegraph@0b66d0a

@bobheadxi
Copy link
Contributor

bobheadxi commented Mar 27, 2022

The update will be included in #1228 ! Thank you for looking into this 🙏

@bobheadxi
Copy link
Contributor

@dleen did the new update resolve your issue?

@dleen
Copy link
Author

dleen commented Apr 12, 2022

Yep! Works perfectly, thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working extension Issues related to one of the extensions in the Store
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants