TypeError: Cannot convert undefined or null to object
See original GitHub issueWhen I write const browser = await puppeteer.launch();
it appears that puppeteer
is undefined or null, because it returns the error in the title. I think this because after commenting out the rest of my code (in my async
function) even when logging to the console it returns the error. Here is the config:
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());
Anyone know what’s happening?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Cannot convert undefined or null to object - Stack Overflow
Generic answer. This error is caused when you call a function that expects an Object as its argument, but pass undefined or null...
Read more >Cannot convert undefined or null to object : r/learnjavascript
Your code throws the error because before fetch completes, location is undefined, but you are telling react to iterate over it, which can't...
Read more >Cannot convert undefined or null to Object in JavaScript
The "Cannot convert undefined or null to Object" error occurs when we pass a null or an undefined value to a function that...
Read more >Object.keys(null) possible - cannot convert undefined or null to ...
Conditions above this line allow msg===null to get into Object.keys(msg);. livedata_connection.js:1626 Uncaught TypeError: Cannot convert ...
Read more >Error: "TypeError: Cannot convert undefined or nul...
Error: "TypeError: Cannot convert undefined or null to object" with Publish to Tableau Server tool. Article Options.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Had the same issue and solved it by changing this line:
const browser = await puppeteer.launch()
To this:
const browser = await puppeteer.launch({})
As ref for the devs to see the source of the issue:
I actually had to add a valid config setting to get this to work:
const browser = await puppeteer.launch( { defaultViewport: { width: 1020, height: 1020, deviceScaleFactor: 1 } } );
Using: