Closed middiu closed 4 years ago
@middiu Can you try it with endpoint discovery turned off?
const client = new CosmosClient({
endpoint,
key,
connectionPolicy: {
enableEndpointDiscovery: false
}
})
There is a known bug around CORS and the endpoint discovery call which we are actively working to fix. ETA Feb 2020
too easy. Thanks @southpolesteve, this fixes the issue.
Thanks a lot
@middiu Glad it worked. I am going to reopen this in case other people run into it and will close it later
A backend change has been deployed that fixes this issue. Using enableEndpointDiscovery: false
is no longer necessary to support CORS
still having the issue for localhost
I found this to still be an issue. I have a module that is called with helper classes to call the api (managed) and the api call the cosmos db to fetch data and bring it back to ultimately be used by the UI,
index>module>helpermodule>api>cosmos
I added the option to the code as noted above : connectionPolicy: { enableEndpointDiscovery: false } and it worked properly to get the data, otherwise it gave a 500 and the underlying cause is CORS.
Describe the bug No matter the CORS settings I put in Azure portal I keep getting the error message "Access to fetch at 'https://xyz.documents.azure.com/' from origin 'https://localhost:3000' has been blocked by CORS policy"
To Reproduce Steps to reproduce the behavior:
Expected behavior I should be able to access cosmos db if https://localhost:3000 is in the CORS hosts list in Azure portal or if that setting is set to * Screenshots If applicable, add screenshots to help explain your problem.
This is my code:
any help or suggestion would be really appreciated.
Additional context Add any other context about the problem here.