Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
[Backport 5.5.x] Upgrade cody web experimental package to 0.2.7 (#63863
Browse files Browse the repository at this point in the history
…) (#63901)

backport https://github.com/sourcegraph/sourcegraph/pull/63863

S2 Cody Web is broken at the moment. New client-config handlers fail
with 401 status because we don't send custom headers, this works for gql
queries since they all are POST requests and the browser automatically
sends an Origin header for them and this is enough for our auth
middleware to check cookies, but with client-config which is rest it's
not the case and we should send `X-Requested-Client: Sourcegraph` header
to make our auth middleware to pass this query correctly

Note that this problem doesn't exist in local builds since we proxy all
requests and add `X-Requested-Client: Sourcegraph` in dev server.

See Cody latest build PR for more details
sourcegraph/cody#4898

## Test plan

CI

Co-authored-by: Vova Kulikov <[email protected]>
  • Loading branch information
michaellzc and vovakulikov authored Jul 18, 2024
1 parent 9cf00da commit 3117b03
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
6 changes: 5 additions & 1 deletion client/web/src/cody/chat/new-chat/NewCodyChatPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export const NewCodyChatPage: FC<NewCodyChatPageProps> = props => {
<CodyPageHeader isSourcegraphDotCom={isSourcegraphDotCom} className={styles.pageHeader} />

<div className={styles.chatContainer}>
<CodyWebChatProvider accessToken="" serverEndpoint={window.location.origin}>
<CodyWebChatProvider
accessToken=""
serverEndpoint={window.location.origin}
customHeaders={window.context.xhrHeaders}
>
<CodyWebHistory>
{history => (
<div className={styles.chatHistory}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const NewCodySidebarWebChat: FC<NewCodySidebarWebChatProps> = memo(functi
chatID={chatID}
initialContext={contextInfo}
serverEndpoint={window.location.origin}
customHeaders={window.context.xhrHeaders}
onNewChatCreated={handleNewChatCreated}
>
<ChatUi />
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
"bloomfilter": "^0.0.18",
"buffer": "^6.0.3",
"classnames": "^2.2.6",
"cody-web-experimental": "^0.2.5",
"cody-web-experimental": "^0.2.7",
"comlink": "^4.3.0",
"copy-to-clipboard": "^3.3.1",
"core-js": "^3.8.2",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3117b03

Please sign in to comment.