sourcegraph / app

Issue tracker for the Sourcegraph app - a lightweight single-binary version of Sourcegraph for your local machine
27 stars 2 forks source link

Embeddings Jobs: `Intl.ListFormat` is not a constructor #31

Closed jimmo closed 1 year ago

jimmo commented 1 year ago

In "Advanced Settings" > "Embeddings Jobs" I get

Sourcegraph encountered an unexpected error. If reloading the page doesn't fix it, contact your site admin or Sourcegraph support.

undefined is not a constructor (evaluating 'new Intl.ListFormat("en",{style:"long",type:"conjunction"})')

I attached the debugger. Intl doesn't have ListFormat (but has other similar things like DateTimeFormat and NumberFormat so I added ListFormat as a dummy function. This made the error go away and I was able to add a job successfully.

I'm sorry I don't know much about the relevant web technologies here to provide more relevant debugging information... running cody_2023.6.28+1331.1867679b11_amd64.AppImage on (Arch) Linux. navigator.userAgent in the debugger is "Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15". It's using libwebkit2gtk-4.0.so.37 from the AppImage.

slimsag commented 1 year ago

Thanks for reporting this! We will look into it and fix it soon.

vovakulikov commented 1 year ago

This is fun. I mean, the fix is relatively easy to do. We're going to wrap up the top-level variable definition to the memo function (so no code that doesn't use it still would be run without error), but the cause of this problem is more interesting. Somehow we got part of the code insight module from the creation in the same chunk with the embeddings list module.

I don't know how this is even possible, I will try to inspect it with Statoscope; maybe something is completely wrong with our bundle, it is also possible that the webpack bundle is ok, but esbuild does something weird there (this would explain why I didn't notice anything last time when I was checking bundle with statoscope)

slimsag commented 1 year ago

Hello @jimmo! We just released a new version which should fix this issue. Please let us know if that helps :)

jimmo commented 1 year ago

@slimsag Yes that has fixed it. Thanks!