It is throwing "URL is not defined error" in Docker
ashwamegh opened this issue · comments
Shashank Shekhar commented
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.
Shashank Shekhar commented
Anyways, I solved it using buildkite/puppeteer
package
FROM buildkite/puppeteer
COPY package*.json ./
RUN npm install
...
Andrej Gajdos commented
@ashwamegh sorry I didn't get back to you. I am glad you were able to solve this.
Shashank Shekhar commented
No problem @AndrejGajdos 👍👍