Install the large-size node modules for the server side actions

It doesn’t seem the bubble allows the large-sized node modules(for example puppeteer) to be installed for the server-side actions due to the limitation of the AWS lambda functions.
Is there any way we can utilize the large-sized npm modules?

What are your dependencies?

It was “puppeteer” dependency.

{
“dependencies”: {
“puppeteer”: “^5.4.0”
}
}

So this doesn’t work for you?

Bubble only cares for you to specify the dependencies section of your package.json and it will need to build it. Once it’s done and it’s accepted, it will have some green text bottom left or red if there’s an issue.

Then refer to it

const puppeteer = require(‘puppeteer’);

what if we want to use a newer version of Puppeteer?

image

And this was the error message when I try to install the 5.4.0

Thank you.

Change it to this.

I was just providing you an example.

{
“dependencies”: {
“puppeteer”: “latest”
}
}

Or I think you can just use your
const puppeteer = require(‘puppeteer’)

And bubble will add the package itself

the issue is, bubble says “no space left for the package” for big dependencies.
or bubble says “the package is deprecated for the older versions”

I got the error too initially, but clicked try again.

Thank you for your help.
Did you try to actually run any puppeteer functions?
for example,
const buffer = context.async(async callback => {
const browser = await puppeteer.launch();
callback(null)
});

Thank you.

I hadn’t tried anything. I just saw that it installed for me the second time around. Have you tried it?

I couldn’t install the package, so couldn’t try the code at all. :slight_smile:

Please help me get an idea of how it works.

Thank you very much.

Just try to install again. It worked for me

Interesting, it works for me now.

Mark that solution for me big dog

4 Likes

One more thing though…


image

This is what I am getting while running the server-side action.

Any idea? :slight_smile:

const puppeteer = require(‘puppeteer’);

async function run() {
// Launch a new browser instance
const browser = await puppeteer.launch();

// Open a new page in the browser
const page = await browser.newPage();

// Navigate to a specific URL
await page.goto(‘https://google.com’);

// Type a query into the search bar
await page.type(‘input[name=q]’, ‘puppeteer’);

// Click on the search button
await page.click(‘input[type=submit]’);

// Wait for the results to load and then print them to the console
await page.waitForSelector(’#resultStats’);
console.log(await page.evaluate(() => document.body.innerText));

// Close the browser
await browser.close();
}

run();

Thank you for the code snippets.

We need to get some sort of result from the puppeteer executives and return it from the server-side action. Therefore we had to use “context.async” function to achieve that.

Thanks

You might have better luck using zapier

We are going to generate pdf from html template, but only by server-side actions.

Is there any alternatives?