ianarawjo / ianarawjo/ChainForge

CORS Policy preventing LLM queries to Azure OpenAI

Open
#117 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
256
Avg merge
4h 40m
Merged PRs (30d)
22

Description

I was trying to run the example queries on the /play page, and ran into CORS issues with all my requests. I've pasted the chrome dev console logs below, but this is broadly what I expect: CORS should prevent the page from making a javascript request to an OpenAI endpoint, right?

Tools like these usually work around CORS by proxying the requests via a non-CORS-violating backend, but it looks like that's not happening here. Am I misunderstanding CORS / doing something strange here. How could this ever have worked?

> Querying Azure OpenAI deployed model 'gpt-35-turbo' at endpoint 'https://api.llm.palantir.tech/preview' with prompt 'What is the opening sentence of The Poppy War by R.F.Kuang?'...

```
Access to fetch at 'https://api.llm.palantir.tech/preview/openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-03-15-preview' from origin 'https://chainforge.ai' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the request from the /play page and inspect the browser's preflight request to the Azure OpenAI endpoint shown in the report. Trace whether the request is intended to use a backend proxy; done means the example query can reach the deployed model without the reported CORS failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, typescript
Domain
api, cloud, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.