Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is throwing "URL is not defined error" in Docker #4

Closed
ashwamegh opened this issue Apr 29, 2020 · 3 comments
Closed

It is throwing "URL is not defined error" in Docker #4

ashwamegh opened this issue Apr 29, 2020 · 3 comments

Comments

@ashwamegh
Copy link

ashwamegh commented Apr 29, 2020

I have added this in one of my APIs with this logic

const { link } = req.body;
	try {
		const previewData = await linkPreviewGenerator(link, [
			'--no-sandbox',
			'--disable-setuid-sandbox'
		  ]);
		return res.json(previewData);
	} catch (error) {
		console.error(error);
		return res.status(500).send(error.message);
	}

And In the Dockerfile, I have added all the dependencies Puppeteer will require to launch chrome.
with this code:

RUN apt-get update \
    && apt-get install -yq --no-install-recommends \
	ca-certificates fonts-liberation gconf-service libappindicator1 \
	libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 \
	libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 \
	libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 \
	libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 \
	libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
	libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils

But when I call the API, it is throwing URL is not defined

I would love, if you can help mw with this.

@ashwamegh
Copy link
Author

Anyways, I solved it using buildkite/puppeteer package

FROM buildkite/puppeteer
COPY package*.json ./
RUN npm install
...

@AndrejGajdos
Copy link
Owner

@ashwamegh sorry I didn't get back to you. I am glad you were able to solve this.

@ashwamegh
Copy link
Author

No problem @AndrejGajdos 👍👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants