R
Runpod•15mo ago
AC

JS pupeteer issue

Hi, I have a pupeteer chromium task that i want to run on the runpod which is written in typescript. I did not see any JS handler. So, i am calling the JS entrypoint via python as below.
""" Example handler file. """

import runpod
from subprocess import call
import os

# If your handler runs inference on a model, load the model here.
# You will want models to be loaded into memory before starting serverless.


def handler(job):
""" Handler function that will be used to process jobs. """
job_input = job['input']

prompt_id = job_input.get('aiPromptId')
video_save_path = job_input.get('videoSavePath')

# Create a copy of the current environment variables
env = os.environ.copy()

# Add or update the required environment variables
env['AI_PROMPT_ID'] = prompt_id
env['VIDEO_SAVE_PATH'] = video_save_path
print("env", env)

print("Running the executeDockerCommand")
# env['NODE_ENV'] = 'development'

call(["yarn", "ts-node", "src/backend/executeDockerCommand.ts"], env=env)

print("Finish running the command")

return f"Hello, {prompt_id}!"


runpod.serverless.start({"handler": handler})
""" Example handler file. """

import runpod
from subprocess import call
import os

# If your handler runs inference on a model, load the model here.
# You will want models to be loaded into memory before starting serverless.


def handler(job):
""" Handler function that will be used to process jobs. """
job_input = job['input']

prompt_id = job_input.get('aiPromptId')
video_save_path = job_input.get('videoSavePath')

# Create a copy of the current environment variables
env = os.environ.copy()

# Add or update the required environment variables
env['AI_PROMPT_ID'] = prompt_id
env['VIDEO_SAVE_PATH'] = video_save_path
print("env", env)

print("Running the executeDockerCommand")
# env['NODE_ENV'] = 'development'

call(["yarn", "ts-node", "src/backend/executeDockerCommand.ts"], env=env)

print("Finish running the command")

return f"Hello, {prompt_id}!"


runpod.serverless.start({"handler": handler})
The above code works fine locally. But, when i deploy to serverless, it kicks off the yarn ts-node ... , but gets stuck and does not emit any logs and eventually times out. Any advice?
25 Replies
Unknown User
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
AC
ACOP•15mo ago
Awesome! Let me try that in the morning.
AC
ACOP•15mo ago
Looks like still stuck and does not emit log or proceeds
No description
Unknown User
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
AC
ACOP•15mo ago
i take that back. Its pupetteer launch issue. I am launching pupeteer with these options
const puppeteerLaunchOpts: PuppeteerLaunchOptions = {
// headless: shouldPerformanceTrace() ? false : 'shell',
headless: true,
devtools: isDev,
args: ['--disable-gpu', '--no-sandbox', '--disable-setuid-sandbox'],
};

const browser = await puppeteer.launch(puppeteerLaunchOpts)
const puppeteerLaunchOpts: PuppeteerLaunchOptions = {
// headless: shouldPerformanceTrace() ? false : 'shell',
headless: true,
devtools: isDev,
args: ['--disable-gpu', '--no-sandbox', '--disable-setuid-sandbox'],
};

const browser = await puppeteer.launch(puppeteerLaunchOpts)
Looks like this gets stuck
Unknown User
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
AC
ACOP•15mo ago
It works fine locally 🤔 i am ssh'ing into the serverless and still seeing the same issue
Unknown User
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
AC
ACOP•15mo ago
its just stuck
Unknown User
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
AC
ACOP•15mo ago
There are no logs being emitted by puppeteer.launch I added logs before and after puppeteer.launch and the log after launch doesnt get triggered.
AC
ACOP•15mo ago
No description
Unknown User
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
AC
ACOP•15mo ago
yea. thats normal it emits locally as well. Unrelated Has anyone ran pupeteer successfully?
Unknown User
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
AC
ACOP•15mo ago
sure. Let me isolate keys and just keep the pupeteer code
AC
ACOP•15mo ago
This is the entire file
AC
ACOP•15mo ago
The entry point is generateAndUploadVideoViaPuppeteer
Unknown User
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
AC
ACOP•15mo ago
got it! trying
Unknown User
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
AC
ACOP•15mo ago
No description
AC
ACOP•15mo ago
Got this now Is there something i need to turn on gpu support via dockerfile?
Unknown User
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
AC
ACOP•15mo ago
Got it. Let me search around.

Did you find this page helpful?