CORS error on logs API

Hi, I am getting a Cors issue on logs API since yesterday.

Access to XMLHttpRequest at ‘https://log-api.eu.newrelic.com/log/v1’ from origin ‘http://localhost:3000’ 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.

Hi, @ehmad92: I don’t think you can call New Relic APIs directly from a browser, because the APIs do not include the necessary Access-Control-Allow-Origin header. You will have to create your own server-side endpoint to call the API, and call that endpoint from your browser.

hi @philweber, thanks for the reply but it was working fine before yesterday and it also working for another account.

I have a similar issue. It was working fine until 1 day ago but now it’s not anymore. How did you solve this issue?

We are facing the same issue. We can’t rely on just APM, we need a way to stream our app events into logs as well.

Having our own back channel isn’t a great outcome.

We should be able to use the logs api from any client (in this case the browser).

I have a similar issue whith grapql, it works fine on postman but when i try to do the reques by nerdpack with a fetch i have an error blocked by cors

fetch(url,{
            method : 'POST',
            headers: { 'API-Key': $mikey, 'Content-Type': 'application/json'},
            body: JSON.stringify({query: `query{
                actor {
                account(id: $myacooountid) {
                    nrql(query: "SELECT count(*) from SystemSample", options: {eventNamespaces: "Default"}, timeout: 5) {
                    rawResponse
                    }
                }
                }
            }
            `})
        })

i use the same api key with postman and works

This topic was automatically closed after 365 days. New replies are no longer allowed.