Skip to content

Commit 1ca40e3

Browse files
authored
fix: browser problem (#6)
1 parent 2801910 commit 1ca40e3

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

apps/web-parser/.puppeteerrc.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @type {import("puppeteer").Configuration}
3+
*/
4+
module.exports = {
5+
skipDownload: true,
6+
}

apps/web-parser/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"build": "nitro build",
66
"dev": "nitro dev",
77
"prepare": "nitro prepare",
8-
"preview": "node .output/server/index.mjs",
9-
"postinstall": "puppeteer browsers install chrome"
8+
"preview": "node .output/server/index.mjs"
109
},
1110
"dependencies": {
1211
"@roll-stack/database": "workspace:*",

apps/web-parser/server/utils/error.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1-
import { type } from 'arktype'
21
import { H3Error } from 'h3'
32

43
const logger = useLogger('error')
54

65
export function errorResolver(exception: unknown) {
7-
if (exception instanceof type.errors) {
8-
throw createError({
9-
statusCode: 400,
10-
message: exception.summary,
11-
})
12-
}
13-
146
if (exception instanceof H3Error) {
157
throw exception
168
}

docker/web-parser/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
FROM node:22.17.1-alpine AS base
2-
ENV NODE_OPTIONS="--max_old_space_size=4096"
32

43
# Builder stage
54
FROM base AS builder
65
WORKDIR /app
76
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
8-
COPY packages ./packages
7+
COPY packages/database ./packages/database
8+
COPY apps/web-parser/.puppeteerrc.cjs ./
99
COPY apps/web-parser ./apps/web-parser
1010
RUN npm install --ignore-scripts -g pnpm && \
1111
pnpm i --frozen-lockfile && \
1212
pnpm build --filter @roll-stack/web-parser
1313

14+
RUN pnpm dlx puppeteer browsers install chrome
15+
1416
# Production stage
1517
FROM base AS production
1618
RUN apk add --no-cache curl
1719
WORKDIR /app
1820

1921
# Copy built artifacts from builder
2022
COPY --from=builder /app/apps/web-parser/.output .
23+
COPY --from=builder /root/.cache/puppeteer /home/appuser/.cache/puppeteer
2124
COPY docker/web-parser/health-check.sh ./
2225

2326
# Running as non-root is a security best practice

0 commit comments

Comments
 (0)