question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing module `@datadog/browser-logs` breaks on Google Cloud Platform

See original GitHub issue

Hi,

We’re experiencing an issue related to @datadog/browser-logs crashing when running from a Google Cloud Platform environment due to the side-effects it performs when imported, namely the binding operations on console.{debug,log,info,warn,error} executed at top-level from module display.ts.

This file contains top-level code assuming it runs in a browser and calls Function.bind for all known logging methods of console object. Such approach works fine in most web browser but breaks on our application hosted on Google Cloud Platform because the implementation of console there doesn’t have a console.debug function. I believe this regression was introduced with https://github.com/DataDog/browser-sdk/pull/1501 as only warn, log and error were previously used and they all exist in GCP.

Current behavior may be intentional and rely on the fact @datadog/browser-logs always runs within a standard web browser, which would be a fair assumption based on the package’s name. However since the package description says it is intended to “send logs to Datadog from web browsers or other Javascript clients”, you may also want to consider improving compatibility by checking the existence of console.debug (and other functions) before trying to bind them.

Please let me know what makes most sense to you 🙂

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
amortemousquecommented, Oct 12, 2022

Thanks for your feedback, we will update the README.md 🙂

0reactions
r3ccommented, Oct 11, 2022

OK then I think I was confused by the part in your README file that mentions “other Javascript clients”. Using the same library for browers and Node.js allowed us easier factorization, but I understand this may not be aligned with the intended usage of this package so we’ll split the codebase on our end. Thanks for your answer 🙂

(I would also recommand updating README.md to avoid any confusion 🙂)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browser Log Collection - Datadog Docs
Browser Log Collection. Send logs to Datadog from web browser pages with the browser logs SDK. With the browser logs SDK, you can...
Read more >
Connect OpenTelemetry Traces and Logs - Datadog Docs
Connecting OpenTelemetry language SDK logs and traces within Datadog is similar to connecting Datadog SDK logs and traces, with a few additional steps:....
Read more >
Troubleshooting - Datadog Docs
If you experience unexpected behavior with Datadog Browser RUM, use this guide to resolve issues quickly. If you continue to have trouble, contact...
Read more >
Google Cloud Platform - Datadog Docs
For applications running in GCE or GKE, the Datadog Agent can be used to collect logs locally. GCP service logs are collected with...
Read more >
Google Cloud Logging - Datadog Docs
The Google Cloud Logging product allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found