Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/linters/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import globals from 'globals'

export default [
{
ignores: ['node_modules/**', 'package-lock.json', '*.log', 'dist/**', 'build/**']
ignores: ['node_modules/**', 'package-lock.json', '*.log', 'dist/**', 'build/**', '**/*.json']
},
js.configs.recommended,
{
Expand All @@ -27,6 +27,8 @@ export default [
}
},
rules: {
'no-useless-assignment': 'off',
'preserve-caught-error': 'off',
// Basic formatting rules
'indent': ['error', 2],
'quotes': ['error', 'single'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ WORKDIR /app

RUN addgroup -S appuser && adduser -S -G appuser appuser

COPY package*.json ./
RUN mkdir -p bigquery-export/src shared
COPY bigquery-export/src/package*.json ./bigquery-export/src/
COPY shared/package*.json ./shared/

WORKDIR /app/bigquery-export/src
RUN --mount=type=cache,target=/root/.npm \
npm ci --omit=dev --no-fund --no-audit

WORKDIR /app
ENV EXPORT_CONFIG=""

COPY . .
COPY bigquery-export/src/ ./bigquery-export/src/
COPY shared/ ./shared/

RUN chown -R appuser:appuser /app

USER appuser

WORKDIR /app/bigquery-export/src

HEALTHCHECK NONE

CMD ["node", "index.js"]
7 changes: 4 additions & 3 deletions infra/bigquery-export/docker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data "external" "source_hash" {
program = [
"bash",
"-c",
"cd ./${var.function_name}/src/ && echo '{\"hash\":\"'$(git ls-files -s | sha1sum | cut -c1-8)'\"}'"
"echo '{\"hash\":\"'$(git ls-files -s ./${var.function_name}/src ./shared | sha1sum | cut -c1-8)'\"}'"
]
}

Expand All @@ -25,8 +25,9 @@ resource "docker_image" "function_image" {
name = "${var.region}-docker.pkg.dev/${var.project}/dataform/${var.function_name}:${data.external.source_hash.result.hash}"

build {
context = "./${var.function_name}/src/"
platform = "linux/amd64"
context = "./"
dockerfile = "./${var.function_name}/Dockerfile"
platform = "linux/amd64"
}
}

Expand Down
4 changes: 2 additions & 2 deletions infra/bigquery-export/src/firestore.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Firestore, FieldPath } from '@google-cloud/firestore'
import { BigQueryExport } from './bigquery.js'
import { BigQueryExport } from 'shared'

export class FirestoreBatch {
constructor() {
Expand Down Expand Up @@ -360,7 +360,7 @@ export class FirestoreBatch {
failedAttempts: error.failedAttempts
}
console.error(`❌ Export to ${exportConfig.collection} failed:`, cleanError)
throw new Error(`Export failed at document ${cleanError.documentPath}: ${cleanError.message} (code: ${cleanError.code})`)
throw new Error(`Export failed at document ${cleanError.documentPath}: ${cleanError.message} (code: ${cleanError.code})`, { cause: error })
}

console.error(`❌ Export to ${exportConfig.collection} failed:`, error)
Expand Down
Loading