3
respostas

Erro No 'Access-Control-Allow-Origin'

Guys, bele?

Estou tendo este erro abaixo. Alguém consegue me dar um help de como resolver? Procurei na internet e aparentemente tem a ver com habilitar o server do heroko a receber chamadas do localhost:3000

jquery.js:8663 GET http://cdc-react.herokuapp.com/api/autores 500 (Internal Server Error)
send @ jquery.js:8663
ajax @ jquery.js:8312
enviaForm @ App.js:33
callCallback @ react-dom.development.js:147
invokeGuardedCallbackDev @ react-dom.development.js:196
invokeGuardedCallback @ react-dom.development.js:250
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:265
executeDispatch @ react-dom.development.js:571
executeDispatchesInOrder @ react-dom.development.js:596
executeDispatchesAndRelease @ react-dom.development.js:695
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:704
forEachAccumulated @ react-dom.development.js:676
runEventsInBatch @ react-dom.development.js:844
runExtractedEventsInBatch @ react-dom.development.js:852
handleTopLevel @ react-dom.development.js:5030
batchedUpdates$1 @ react-dom.development.js:21469
batchedUpdates @ react-dom.development.js:2247
dispatchEvent @ react-dom.development.js:5110
(anonymous) @ react-dom.development.js:21526
unstable_runWithPriority @ scheduler.development.js:255
interactiveUpdates$1 @ react-dom.development.js:21525
interactiveUpdates @ react-dom.development.js:2268
dispatchInteractiveEvent @ react-dom.development.js:5086
localhost/:1 Access to XMLHttpRequest at 'http://cdc-react.herokuapp.com/api/autores' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Muito obrigado!

3 respostas

Fala aí Leandro, tudo bem? Parece ser um erro na API hospedada no Heroku, vou pedir para o pessoal dar uma olhada.

Obrigado pelo feedback e desculpa qualquer transtorno.

Abraços e bons estudos.

Matheus, tudo certo e por aí?

Tranquilo, fico no aguardo! Infelizmente continuo com o problema hoje pela manhã :(

Abraço!

Nada ainda. Ninguém me respondeu e eu continou fazendo o curso sem conseguir realizar o post...

Access to XMLHttpRequest at 'http://cdc-react.herokuapp.com/api/livros' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.