cube-js / cube

📊 Cube — The Semantic Layer for Building Data Applications
https://cube.dev
Other
17.65k stars 1.75k forks source link

@cubejs-client/core causes core-js/modules/es.array.map.js error #7195

Closed yardenas closed 10 months ago

yardenas commented 10 months ago

Describe the bug When running cube/core from within a nextjs server, after upgrading to nextjs 13.5.4, seems like cube fails to run

To Reproduce Dockerfile: Steps to reproduce the behavior:

ARG NODE_VERSION="18.12.1"

# change with the Linux Alpine version of your choice
ARG ALPINE_VERSION="3.17"

FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} AS base

# Install dependencies only when needed
FROM base AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY . .
RUN npm ci

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
ENV NEXT_TELEMETRY_DISABLED 1

RUN npm run build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000

ENV PORT 3000

CMD ["node", "server.js"]

package.json file

{
  "name": "obol-app-frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "prettier": "prettier --write .",
    "prettier:check": "prettier --check ./src/",
    "prebuild": "scripts/prebuild.sh",
    "db:migrate": "npx prisma migrate deploy && npx prisma generate",
    "test": "playwright test"
  },
  "resolutions": {
    "webpack": "^5"
  },
  "dependencies": {
    "@cubejs-client/core": "^0.31.46",
    "@cubejs-client/react": "^0.31.46",
    "@emotion/react": "^11.10.6",
    "@emotion/server": "^11.10.0",
    "@mantine/core": "^6.0.18",
    "@mantine/dates": "^6.0.18",
    "@mantine/form": "^6.0.18",
    "@mantine/hooks": "^6.0.18",
    "@mantine/next": "^6.0.18",
    "@mantine/notifications": "^6.0.18",
    "@next-auth/prisma-adapter": "^1.0.5",
    "@phosphor-icons/react": "^2.0.6",
    "@prisma/client": "^4.15.0",
    "@tabler/icons-react": "^2.30.0",
    "@types/is-ci": "^3.0.0",
    "apexcharts": "^3.37.2",
    "cookie-cutter": "^0.2.0",
    "core-js": "^3.33.0",
    "country-data": "^0.0.31",
    "dayjs": "^1.11.7",
    "fast-deep-equal": "^3.1.3",
    "ioredis": "^5.2.5",
    "is-ci": "^3.0.1",
    "jose": "^4.11.2",
    "js-sha256": "^0.9.0",
    "jwt-decode": "^3.1.2",
    "mantine-react-table": "^1.0.0",
    "nanoid": "^3.3.4",
    "next": "^13.5.4",
    "next-auth": "^4.22.1",
    "next-connect": "^1.0.0-next.3",
    "phosphor-react": "^1.4.1",
    "pino": "^8.10.0",
    "plaid": "^12.2.0",
    "posthog-js": "^1.77.2",
    "raw-body": "^2.5.1",
    "react": "^18.2.0",
    "react-apexcharts": "^1.4.0",
    "react-dom": "^18.2.0",
    "react-error-boundary": "^3.1.4",
    "react-intl": "^6.2.10",
    "react-plaid-link": "^3.3.2",
    "redis": "^4.5.1",
    "safe-compare": "^1.1.4",
    "sharp": "^0.32.5",
    "swr": "^2.1.5",
    "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz",
    "zod": "^3.21.4",
    "zustand": "^4.3.8"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3",
    "@openapitools/openapi-generator-cli": "^2.5.2",
    "@playwright/test": "^1.36.1",
    "@types/country-data": "^0.0.2",
    "@types/node": "^18.8.2",
    "@types/react": "18.0.21",
    "@types/react-dom": "18.0.6",
    "@types/redis": "^4.0.11",
    "@types/safe-compare": "^1.1.0",
    "@types/snowflake-sdk": "^1.6.11",
    "@typescript-eslint/eslint-plugin": "^5.57.0",
    "@typescript-eslint/parser": "^5.57.0",
    "autoprefixer": "^10.4.12",
    "babel-loader": "^8.2.5",
    "docker-compose": "^0.24.1",
    "dotenv": "^16.3.1",
    "eslint": "^8.37.0",
    "eslint-config-next": "^13.2.4",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "husky": "^8.0.1",
    "pino-pretty": "^10.0.1",
    "prettier": "^2.7.1",
    "prettier-plugin-organize-imports": "^3.2.3",
    "prisma": "^4.13.0",
    "typescript": "^4.8.4"
  },
  "volta": {
    "node": "18.12.0"
  }
}

Run

  1. docker build --no-cache -t tagname .
  2. docker run -p 127.0.0.1:3000:3000 tagname
  3. Navigate to localhost:3000 in your browser.

Expected behavior cubejs-core doesn't cause the app to crash

Screenshots N/A

Minimally reproducible Cube Schema N/A

Version: 0.31.46

Additional context Add any other context about the problem here.

yardenas commented 10 months ago

Seems like a very similar issue to https://github.com/cube-js/cube/issues/418, although their solution didn't work for us (probably since it's quite old)

igorlukanin commented 10 months ago

Hey @yardenas 👋 I see that you've closed this issue—were you able to resolve it? If so, may you please share the details?

Also, if you recall, what we the error message or any output that you saw when the app crashed?