Axios v1 Upgrade: CORS Error Triggered by useCache: true Option
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- frontend
Direzione di ricerca
Inizia tracciando l’integrazione di axios di frontend-platform e l’opzione useCache: true. Riproduci il fallimento CORS, determina se si tratta di un avviso di deprecazione o di un’altra modifica e verifica il comportamento scelto con richieste che utilizzano il caching lato client.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A recent upgrade to axios v1 in frontend-platform caused a CORS error for what appears to be single API call (as far as we have been able to tell) in Enterprise Learner Portal MFE, though it's largely unclear whether it potentially impacts more APIs than this one.
The JavaScript error associated with the failed request suggests the following:
request header field cache-control is not allowed
It was identified that the MFE calling this affected API was using the opt-in useCache: true option, to enable client-side caching on responses to this API for performance optimizations and preventing loading states where possible.
The CORS error was resolved by removing the useCache: true option, which results in the pre-flight OPTIONS request to pass the CORS check and resolve the response successfully.
If running into CORS errors on requests due to the above error, check if you're using useCache: true; if so, the recommendation is to opt out of frontend-platform's client-side caching baked into the axios HTTP client, in favor of relying on other, more widely accepted means of client-side caching (e.g., with @tanstack/react-query).
We may consider adding a deprecation warning when useCache: true is used, as a "use-at-your-own-risk" sort of warning but likely to also mention its eventual deprecation.
- Lingua principale
- JavaScript
- Stelle
- 38
- Fork
- 90
- Merge medio
- 3m
- PR unite (30g)
- 4
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openedx/frontend-platform
-
a11y
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
openedx/frontend-platform#745 · 3 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
openedx/frontend-platform#892 · 4 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
openedx/frontend-platform#837 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
openedx/frontend-platform#835 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
openedx/frontend-platform#833 ·
Tutte le issue di openedx/frontend-platform
Issue simili
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
enhancement good first issue severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TMHSDigital/Static_Chess#163 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Account menu (footer ⚙) doesn't dismiss on outside click — stays open and covers the Bot listAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Fei2411/DeepSeek-Bot#1693 ·
-
area-templates triage:bot-seen triage:needs-human
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
microsoft/aspire#22356 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno