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] Browser crashing when trying to use mic permission

See original GitHub issue

Context:

  • Playwright Version: 1.1.1
  • Operating System: Mac
  • Node version: 12.16.1
  • Browser: Chromium

Code Snippet

const { chromium } = require('playwright')

;(async () => {
  const browser = await chromium.launchPersistentContext(`./udd`, {
    defaultViewport: null,
    headless: false,
    ignoreDefaultArgs: true,
    timeout: 0,
    args: [`--profile-directory=Default`],
  })
  const context = await browser.newContext()
  const page = await context.newPage()
  await page.goto('https://google.com/')
})()

Describe the bug Run the code and once the browser is launched, go to https://google.com. On google homepage, click on the mic icon in search bar and allow it to record. As soon as permissions are given, the browser will crash.

Crash logs:

> DEBUG=pw* node index.js

  pw:api => chromium.launchPersistentContext started +0ms
  pw:browser   <launching> /Users/vikramtiwari/Library/Caches/ms-playwright/chromium-775089/chrome-mac/Chromium.app/Contents/MacOS/Chromium --profile-directory=Default +0ms
  pw:browser   <launched> pid=90433 +4ms
  pw:protocol SEND ► {"id":1,"method":"Target.setDiscoverTargets","params":{"discover":true}} +0ms
  pw:protocol SEND ► {"id":2,"method":"Target.setAutoAttach","params":{"autoAttach":true,"waitForDebuggerOnStart":true,"flatten":true}} +1ms
  pw:protocol SEND ► {"id":3,"method":"Browser.setDownloadBehavior","params":{"behavior":"deny","downloadPath":"/var/folders/pr/s986k1jj66q63zkykxz69r5w0000gn/T/playwright_downloads-kBpigs"}} +0ms
  pw:browser:err   [90433:775:0619/093409.508446:ERROR:page_load_metrics_update_dispatcher.cc(181)] Invalid first_paint 0.286 s for first_meaningful_paint 0.284 s +0ms
  pw:browser:err   [90433:775:0619/093410.765644:ERROR:page_load_metrics_update_dispatcher.cc(181)] Invalid first_paint 0.286 s for first_meaningful_paint 0.284 s +1s
  pw:browser:err   [90433:775:0619/093412.517023:ERROR:page_load_metrics_update_dispatcher.cc(181)] Invalid first_paint 0.286 s for first_meaningful_paint 0.284 s +2s
  pw:browser:err   [90433:775:0619/093414.034441:ERROR:page_load_metrics_update_dispatcher.cc(181)] Invalid first_paint 0.286 s for first_meaningful_paint 0.284 s +2s
  pw:browser:err   Received signal 6 +699ms
  pw:browser:err    [0x000106b43629] +0ms
  pw:browser:err    [0x000106a8b5d3] +0ms
  pw:browser:err    [0x000106b43541] +0ms
  pw:browser:err    [0x7fff6d0be5fd] +0ms
  pw:browser:err    [0x7fff6cf7dad3] +1ms
  pw:browser:err    [0x7fff6d028411] +0ms
  pw:browser:err    [0x7fff6370a59f] +0ms
  pw:browser:err    [0x7fff63708531] +0ms
  pw:browser:err    [0x7fff63708a58] +0ms
  pw:browser:err    [0x7fff6d10b28f] +0ms
  pw:browser:err    [0x7fff6d10b217] +0ms
  pw:browser:err    [0x7fff6ce6c6c2] +0ms
  pw:browser:err    [0x7fff6ce8315d] +0ms
  pw:browser:err    [0x7fff6ce7b5f9] +0ms
  pw:browser:err    [0x7fff6d0c6a85] +0ms
  pw:browser:err    [0x7fff6d0c5b77] +0ms
  pw:browser:err   [end of stack trace] +0ms
  pw:browser:err   [0619/093414.923877:WARNING:crash_report_exception_handler.cc(240)] UniversalExceptionRaise: (os/kern) failure (5) +191ms
  pw:api <= chromium.launchPersistentContext failed +15s
  pw:browser <gracefully close start> +15s
  pw:browser <kill> +1ms
  pw:browser <process did exit: exitCode=null, signal=SIGKILL> +13ms
  pw:browser <gracefully close end> +5ms
(node:90431) UnhandledPromiseRejectionWarning: Protocol error (Target.setDiscoverTargets): Target closed.
========== chromium.launchPersistentContext logs ==========
<launching> /Users/vikramtiwari/Library/Caches/ms-playwright/chromium-775089/chrome-mac/Chromium.app/Contents/MacOS/Chromium --profile-directory=Default
<launched> pid=90433
[90433:775:0619/093409.508446:ERROR:page_load_metrics_update_dispatcher.cc(181)] Invalid first_paint 0.286 s for first_meaningful_paint 0.284 s
[90433:775:0619/093410.765644:ERROR:page_load_metrics_update_dispatcher.cc(181)] Invalid first_paint 0.286 s for first_meaningful_paint 0.284 s
[90433:775:0619/093412.517023:ERROR:page_load_metrics_update_dispatcher.cc(181)] Invalid first_paint 0.286 s for first_meaningful_paint 0.284 s
[90433:775:0619/093414.034441:ERROR:page_load_metrics_update_dispatcher.cc(181)] Invalid first_paint 0.286 s for first_meaningful_paint 0.284 s
Received signal 6
 [0x000106b43629]
 [0x000106a8b5d3]
 [0x000106b43541]
 [0x7fff6d0be5fd]
 [0x7fff6cf7dad3]
 [0x7fff6d028411]
 [0x7fff6370a59f]
 [0x7fff63708531]
 [0x7fff63708a58]
 [0x7fff6d10b28f]
 [0x7fff6d10b217]
 [0x7fff6ce6c6c2]
 [0x7fff6ce8315d]
 [0x7fff6ce7b5f9]
 [0x7fff6d0c6a85]
 [0x7fff6d0c5b77]
[end of stack trace]
[0619/093414.923877:WARNING:crash_report_exception_handler.cc(240)] UniversalExceptionRaise: (os/kern) failure (5)
============================================================
Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.Error
    at /Users/vikramtiwari/Documents/code/pw-test/node_modules/playwright/lib/chromium/crConnection.js:132:63
    at new Promise (<anonymous>)
    at CRSession.send (/Users/vikramtiwari/Documents/code/pw-test/node_modules/playwright/lib/chromium/crConnection.js:131:16)
    at CRSession.send (/Users/vikramtiwari/Documents/code/pw-test/node_modules/playwright/lib/helper.js:65:31)
    at Function.connect (/Users/vikramtiwari/Documents/code/pw-test/node_modules/playwright/lib/chromium/crBrowser.js:71:39)
    at Chromium._connectToTransport (/Users/vikramtiwari/Documents/code/pw-test/node_modules/playwright/lib/server/chromium.js:52:38)
    at Chromium._innerLaunch (/Users/vikramtiwari/Documents/code/pw-test/node_modules/playwright/lib/server/browserType.js:86:36)
    at async ProgressController.run (/Users/vikramtiwari/Documents/code/pw-test/node_modules/playwright/lib/progress.js:76:28)
    at async Chromium.launchPersistentContext (/Users/vikramtiwari/Documents/code/pw-test/node_modules/playwright/lib/server/browserType.js:68:25)
    at async /Users/vikramtiwari/Documents/code/pw-test/index.js:4:19
(node:90431) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:90431) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aslushnikovcommented, Jul 8, 2020

Is there a place where I can see all the possible values that I can pass to the permissions field?

@VikramTiwari all the permissions are listed here: https://playwright.dev/#version=v1.2.0&path=docs%2Fapi.md&q=browsercontextgrantpermissionspermissions-options

However, different browsers support different permissions. I’d dig which one supports which.

1reaction
aslushnikovcommented, Jun 22, 2020

@VikramTiwari First of all, the browserType.launchPersistentContext() method returns browserContext, not browser. So your script would require changing.

Next, I debugged this a bit, and here are my findings:

  • the google.com doesn’t let me use mic in firefox or safari - there’s simply no button.
  • the google.com on Chromium does have the mic button, but the recording still won’t work. I suspect that it relies on using google services for speech recognition, and keys to access these services are not bundled to chromium

To run your script with Playwright 1.1.1 and Chrome, we’d need to use Chrome 85, which is currently (June, 22) available as Canary channel. The following worked just fine for me on Mac:

const {chromium} = require('playwright');

(async () => {
  const context = await chromium.launchPersistentContext('./chprofile', {
    executablePath: `/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary`,
    defaultViewport: null,
    headless: false,
    permissions: ['microphone'],
  });
  const page = await context.newPage()
  await page.goto('https://google.com/')
})()

I’ll close this since there’s no good repro atm. Feel free to refile/nag us if the crash is still happenning and you have a good repro for us to try.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

window crashes when i open camera or microphone setting in ...
Navigate to Settings > Privacy > Camera. · Make sure that Let apps use my camera hardware is toggled ON. · Under Choose...
Read more >
Use your camera & microphone - Google Chrome Help
In the dialogue, select Open preferences. · To enable camera or mic permissions: Camera: Click Camera and then Select the checkbox next to...
Read more >
Causing Browser Crash | v98.0.1108.50 Stable | Linux/Ubuntu
Allowing Microphone -> Causing Browser Crash | v98.0.1108.50 Stable | Linux/Ubuntu. r/edge - Google Translate ô wants to = Google Trans O ...
Read more >
7 Ways to Fix Chrome if it Can't Access the Camera or ...
Chrome can't access the camera or microphone lately, it's generally the misconfigured settings or driver issues to blame.
Read more >
2 SOLUTIONS ! Can't click ALLOW or BLOCK Chrome mic ...
if any website wants to use your camera and microphone and you can ... fix when chrome freezes on app permission prompts [...
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