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] Interface 'Browser' incorrectly extends interface 'BrowserContext'

See original GitHub issue

Environment

  • chrome-aws-lambda Version: 5.2.0
  • puppeteer / puppeteer-core Version: 5.2.1
  • OS: Mac
  • Node.js Version: 12.x
  • Lambda / GCF Runtime: nodejs12.x

Expected Behavior

TypeScript should compile without mismatched interface

Current Behavior

Upon compile, it seems interface Browser isn’t typed properly.

node_modules/@types/puppeteer/index.d.ts:1814:18 - error TS2430: Interface 'Browser' incorrectly extends interface 'BrowserContext'.
  The types returned by 'targets()' are incompatible between these types.
    Type 'Promise<Target[]>' is missing the following properties from type 'Target[]': length, pop, push, concat, and 26 more.

1814 export interface Browser extends EventEmitter, TargetAwaiter {

Steps to Reproduce

{
  "devDependencies": {
    "@types/node": "^12",
    "@types/puppeteer": "3.0.1",
    "@typescript-eslint/eslint-plugin": "^3.6.1",
    "@typescript-eslint/parser": "^3.6.1",
    "aws-sdk": "^2.725.0",
    "eslint": "^7.4.0",
    "puppeteer": "^5.2.1",
    "typescript": "^3.9.7"
  },
  "dependencies": {
    "chrome-aws-lambda": "5.2.0",
    "puppeteer-core": "5.2.1"
  }
}
import chromium from "chrome-aws-lambda";
export async function example(): Promise<void> {
  const browser = await chromium.puppeteer.launch({
    executablePath: await chromium.executablePath,
    args: chromium.args,
    defaultViewport: chromium.defaultViewport,
    headless: chromium.headless,
    ignoreHTTPSErrors: true,
  });
}

Possible Solution

I’m honestly not sure if this is a bug or I’m doing something wrong. Please advise.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
benlongmirecommented, Aug 6, 2020

Thanks for the extra info. Unfortunately I haven’t had a chance to look at this.

I’ll be able to spend some limited time on this starting tomorrow (it’s Friday today in Australia).

I’ll let you know how I go ASAP.

0reactions
alixaxelcommented, Aug 12, 2020

@benlongmire This should be handled now on the latest version (5.2.1).

The problem is @types/puppeteer is still lagging behind and puppeteer haven’t yet shipped their typings. 🤷🏻‍♂️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Context menu items - Mozilla - MDN Web Docs
This user interface option adds one or more items to a browser context menu. This is the context menu available when a user...
Read more >
Augmentations for the global scope can only be directly ...
You can indicate that the file is a module like so: export {}; declare global { namespace NodeJS { interface Global { config:...
Read more >
BrowserContext (Playwright - Main Library 1.12.1 API)
public interface BrowserContext extends AutoCloseable. BrowserContexts provide a way to operate multiple independent browser sessions.
Read more >
Flexible and Dynamic Test Fixtures in Playwright - Medium
To use the fixture in our tests, we extend the test object to include our fixture, and naturally, ... We can define the...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Fixed an issue where browser.tabs sometimes returned an incorrect URL for pinned ... If you see bugs or unexpected behavior with the interface...
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