My FeedDiscussionsHeadless CMS
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Guy Goldenberg

11 likes

·

1.1K reads

4 comments

Sergiy Voznyak
Sergiy Voznyak
Nov 9, 2023

Hi Guy! Thank you very much for sharing your experience. Did you face a CORS error while sending logs to DD from the extension? I have a problem: all requests, either from background or content are rejected by Datadog with the error:

Access to fetch at 'http-intake.logs.datadoghq.eu/api/v2/logs' from origin 'chrome-extension://*********' has been blocked by CORS policy: Request header field dd-api-key is not allowed by Access-Control-Allow-Headers in preflight response.

Postman's exact (absolutely the same) request passed successfully (code 202 and entry in Datadog).

2
·
·1 reply
Guy Goldenberg
Guy Goldenberg
Author
·Nov 28, 2023

Interesting! Generally, since the API should be accessible and must receive this header, I suspect this might be related to the endpoint you are trying to send the logs to.

I see that you are using http-intake.logs.datadoghq.eu/api/v2/logs

It's worth trying to send the requests to https://http-intake.logs.datadoghq.com/api/v2/logs (.com instead of .eu)

Let me know if it works :)

·
Yonatan Eilat
Yonatan Eilat
Jul 25, 2023

This blog just saved me. I had the document is not defied error for so long. Great blog, I’m sure it’s going to serve me in the future and a lot of other developers.

1
·
John Gordon
John Gordon
Feb 1, 2024

Just in case other people run into this:

I was getting 403's when I implemented the solution in this blog. It turns out that my company uses a different datadog enpoint than the default. So if you're using a different one, here's how to configure it:

const configuration = client.createConfiguration({
  authMethods: {
    apiKeyAuth: "pub...",
  },
});

configuration.setServerVariables({
  site: "us5.datadoghq.com"
});

const apiInstance = new v2.LogsApi(configuration);
·