How to Resolve Puppeteer Import Error and Lack of Connect Function in Pipedream Package?

This topic was automatically generated from Slack. You can find the original thread here.

Hello :slightly_smiling_face: , a week ago I was able to use Puppeteer like this: import puppeteer from ‘puppeteer’;

But now I receive this error: Cannot require puppeteer. puppeteer is supported via a custom Pipedream package. Please see the docs: Browser Automation with Node.js

I dont want to use this one

 import { puppeteer } from '@pipedream/browsers';

as it does not have connect function.

Can you help please

Hi, Pipedream supports only specific version of puppeteer. I would recommend you to search for workaround if possible

what do you mean by that ? which version can I use ? It was working just fine a week ago :slightly_smiling_face:

, I mean you will need to use @pipedream/browsers , as it is confirmed by Pipedream team that it is compatible with Pipedream.

The puppeteer will get updated frequently, and it take some time for Pipedream team to make the new version with Pipedream platform.

what do you suggest so I can use puppeteer.connect ?

and why did you delete this import puppeteer from ‘puppeteer’; ?

can you share more about the use case / share your code? Were you connecting to a remote Chrome instance?

Hello , yes I would like to connect to a remote chrome browser that has more capacities (Captcha unlocking, headful browser and other options). I tried the workflow last week and it was working fine, but I think that you pushed a new version that prevents using regular Puppeteer

juste to give you more information, pipedream/browsers works fine but not with certain websites that are JS heavy or with advanced locking features

Got it thanks, we did push this update and I’ll share with the team. At the very least I believe we can just expose the connect method for you in our wrapper package

that would be very helpful ! thank you :slightly_smiling_face:

Please let me know when you do the change because I started developing a cloud function outside pipedream and then sending an http request, but the idea is to use pipedream for the whole workflow

thank you :slightly_smiling_face:

Puppeteer also publishes a puppeteer-core package, which can be used to connect to a remote browser. As a workaround, does that work for your use case?

import puppeteer from 'puppeteer-core'; 

That’s perfect !!! thank you :slightly_smiling_face:

import puppeteer from 'puppeteer-core'; 

works fine thank you !!

that’s great, yeah I’m glad Jacob suggested that so you’re unblocked. We’re also planning to clarify this in our docs / throw a more subtle help message vs. the error blocking you from using puppeteer directly.

Jacob also noted to me that puppeteer-core is probably better anyway since it doesn’t contain the local browser (and you don’t need it since you’re just connecting remotely), so the workflow will likely be faster to cold start too