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.

[BUG] debug.enable('pw:api') does not work in 1.25 (worked in 1.20)

See original GitHub issue

Context:

  • Playwright Version: 1.25.0
  • Operating System: Mac
  • Node.js version: 14.19.2

Describe the bug

This is regarding the logging that you get with DEBUG=pw:api.

I am upgrading from Playwright 1.20.1 to 1.25.0. We use Playwright with the Mocha testrunner, launched from a Node script.

The following works in Playwright 1.20.1, but does not work in Playwright 1.25.0 (no other changes):

import debug from 'debug';
debug.enable('pw:api')

Note that I get the logging if I set DEBUG=pw:api from the command line when starting up Node. It just doesn’t work when using the debug library like above.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rwollcommented, Aug 12, 2022

Thanks for your report! If you need logs, using the environment variable or Logger API are the correct ways of doing it.

To my knowledge:

import debug from 'debug';
debug.enable('pw:api')

is not documented to be supported by PW, and the fact it was working before was merely a coincidence. 😄 While convenient, the fact PW uses the debug package is an implementation detail that should not be depended upon. My best guess as to why it stopped working: we started bundling Playwright’s deps within the last few months so the PW package now has zero deps (https://www.npmjs.com/package/playwright-core)!

0reactions
rwollcommented, Sep 20, 2022

Any chance the extra logger info will make it into 1.27?

There are no plans at the moment. (When we have an idea of a release milestone, we tag with v1.XY.)

Would you be open to contributing a PR?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting common PHP debugging issues | PhpStorm ...
This section provides the list of solutions and workarounds for common problems with Debugging in PhpStorm. Collecting PhpStorm debugging logs.
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