Skip to content

Commit 1b10f4f

Browse files
authored
Merge pull request #75 from johnvesslyalti/fix/use-native-fetch
fix(api): force OpenAI client to use native globalThis.fetch
2 parents e027773 + d1b346e commit 1b10f4f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/api/src/ai/ai.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ export class AiService {
1313
private readonly client: OpenAI;
1414

1515
constructor(@Inject(DRIZZLE) private db: DrizzleDB) {
16-
const rawClient = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
16+
const rawClient = new OpenAI({
17+
apiKey: process.env.OPENAI_API_KEY,
18+
fetch: globalThis.fetch as any,
19+
});
1720
if (process.env.LANGFUSE_PUBLIC_KEY && process.env.LANGFUSE_SECRET_KEY) {
1821
this.logger.log('Wrapping OpenAI client with Langfuse observer.');
1922
this.client = observeOpenAI(rawClient);

0 commit comments

Comments
 (0)