Skip to content

Commit

Permalink
Fix bundle error by removing nodeOptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlewi committed Aug 2, 2024
1 parent a6e0136 commit b70c22c
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/extension/ai/stream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as http2 from 'node:http2'

import { createPromiseClient, Transport } from '@bufbuild/connect'
import { createConnectTransport } from '@bufbuild/connect-node'
import { AIService } from '@buf/jlewi_foyle.connectrpc_es/foyle/v1alpha1/agent_connect'
Expand Down Expand Up @@ -257,22 +255,13 @@ class PromiseIterator<T> {
}

function createDefaultTransport(): Transport {
let options = {
// Create a custom HTTP/2 client
createClient: (authority: string | URL) => {
return http2.connect(authority, {
// Allow insecure HTTP connections
rejectUnauthorized: false,
})
},
}
return createConnectTransport({
// eslint-disable-next-line max-len
// Copied from https://github.com/connectrpc/examples-es/blob/656f27bbbfb218f1a6dce2c38d39f790859298f1/vanilla-node/client.ts#L25
// N.B unlike https://github.com/connectrpc/examples-es/blob/656f27bbbfb218f1a6dce2c38d39f790859298f1/vanilla-node/client.ts#L25
// For some reason I didn't seem to have to allow unauthorized connections.
// Do we need to use http2?
httpVersion: '2',
// baseUrl needs to include the path prefix.
baseUrl: baseUrl,
nodeOptions: options,
})
}

0 comments on commit b70c22c

Please sign in to comment.