Skip to content

Docker Compose crashes when using @sentry/nextjs #9405

Closed as not planned
Closed as not planned
@fimbres

Description

@fimbres

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

^7.74.1

Framework Version

Next.js 13.5.5, React: 18.2.0

Link to Sentry event

No response

SDK Setup

sentry config:
`/ This file configures the initialization of Sentry on the client.
// The config you add here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/

import * as Sentry from "@sentry/nextjs";

Sentry.init({
dsn: "https://f24c7de63b0064121f43c8c8c83dc047@o4506087957921792.ingest.sentry.io/4506087959429120",

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

replaysOnErrorSampleRate: 1.0,

// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,

// You can remove this option if you're not planning to use the Sentry Session Replay feature:
integrations: [
new Sentry.Replay({
// Additional Replay configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});
`

Steps to Reproduce

  1. following up the automatically setup from sentry.io in the webapp.
  2. implement docker to deploy the app
  3. use docker compose
  4. the app first crashes getting the error Module not found: Can't resolve '@sentry/utils/esm/buildPolyfills',
  5. then I install @sentry/utils
  6. the app crashes again getting the error Sentry CLI Plugin: Command failed: /dility/node_modules/.pnpm/@[email protected][email protected]/node_modules/@sentry/cli/sentry-cli releases new qocVBIgiVuEmOR8MUS5Ey 16.79 /dility/node_modules/.pnpm/@[email protected][email protected]/node_modules/@sentry/cli/sentry-cli: 2: Syntax error: "(" unexpected
  7. adding RUN pnpm add @sentry/cli in Dockerfile to see if that works but it throws the same error.

Dockerfile and docker compose files:
`FROM node:latest

WORKDIR /dility
COPY package.json pnpm-lock.yaml /dility/
RUN npm install -g pnpm
&& pnpm install
RUN pnpm add @sentry/utils
RUN pnpm add @sentry/cli

COPY . .
RUN pnpm run build
EXPOSE 3000
CMD ["pnpm", "start"]
`

version: '3' services: app: build: context: . dockerfile: Dockerfile ports: - '3000:3000' volumes: - .:/dility environment: - NODE_ENV=production

Expected Result

Getting my app deployed

Actual Result

My app is crashing with this error:
Sentry CLI Plugin: Command failed: /dility/node_modules/.pnpm/@[email protected][email protected]/node_modules/@sentry/cli/sentry-cli releases new qocVBIgiVuEmOR8MUS5Ey 16.79 /dility/node_modules/.pnpm/@[email protected][email protected]/node_modules/@sentry/cli/sentry-cli: 2: Syntax error: "(" unexpected

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions