Closed fimbres closed 11 months ago
Hi, since this might have to do with some dependencies clashing in your lockfile, would you mind providing a small repro repo we can clone to effectively debug this? Thanks.
As a workaround in the meanwhile you could set:
disableServerWebpackPlugin: true,
disableClientWebpackPlugin: true,
in you next.config.js. Note that this will prevent source maps from being uploaded.
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
Have you fixed this issue yet? Running into the same issue.
The issue still happens. My workaround was using this node image node:18.15.0
, if I use alpine or any other node image it crashes
You have to add the ca-certificates package from apt to the ubuntu instance.
Jetbrains AI to the rescue when I asked it the following:
I am trying to authenticate sentry in a dockerfile for nextjs but I get the following error:
caused by: [60] SSL peer certificate or SSH remote key was not OK (SSL certificate problem: unable to get local issuer certificate)
It responsed with:
Based on the error message you provided, it appears your Docker image is experiencing problems authenticating the SSL certificate for Sentry during the build process. This is commonly because it can't verify the SSL certificate's issuer.
Here are a few things you can check and attempt to solve this:
Check your Clock and TimeZone: SSL certificates are sensitive to time. Please make sure your local machine and Docker container timezone settings and clock are correct.
Investigate a Proxy or Firewall Issue: If you're connected to the internet via a proxy server or you have a firewall active, it might be blocking your SSL handshake. You might have to configure the proxy settings for Docker or temporarily disable your firewall to see if this is causing the problem.
Installing Certificate on Docker: You might need to install (or update) the CA certificates package in your Dockerfile. Don't forget that this will increase the build time of your image, as it needs to install the certificates before anything else:
Here's an example of what you can add to your Dockerfile:
FROM node:14 RUN apt-get update && apt-get install -y ca-certificates
Disable SSL Verification (not recommended): This is generally not a recommended solution, as it would bypass SSL certificate verification and could expose your data transfer to potential risks. It's more suitable for a local development or testing environment, not for a production environment. Depending on your Sentry client, this option might differ, refer to the respective Sentry SDK to see if it provides an option to disable SSL verification.
Remember, changes in Dockerfile would require you to rebuild your image. Given that SSL certificate errors may reveal a more serious problem, it would be best to diagnose and correct the SSL issue, rather than simply bypassing the certificate error.
FROM node:21-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
RUN apt-get update -y
RUN apt-get install -y ca-certificates
FROM base AS build
WORKDIR /app
ARG NPM_TOKEN
RUN echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
# Write to .env
ARG NEXT_PUBLIC_API_URL="http://127.0.0.1:5000/tracking"
RUN echo "NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}" >> .env
ARG NEXT_OUTPUT="standalone"
RUN echo "NEXT_OUTPUT=${NEXT_OUTPUT}" >> .env
ARG SENTRY_AUTH_TOKEN
RUN echo "SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}" >> .env
# Disable telemetry during build time
ENV NEXT_TELEMETRY_DISABLED 1
RUN npm run build
FROM base
WORKDIR /app
COPY --from=build /app/node_modules /app/node_modules
# Disable telemetry during runtime
ENV NEXT_TELEMETRY_DISABLED 1
# Add nextjs user and group
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=build --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=build --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT 3000
CMD ["node", "server.js"]
version: "3"
services:
nextjs:
container_name: next-app
build:
dockerfile: ./Dockerfile
context: .
args:
- NPM_TOKEN=
- NEXT_PUBLIC_API_URL=
- SENTRY_AUTH_TOKEN=
ports:
- 3000:3000
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
Module not found: Can't resolve '@sentry/utils/esm/buildPolyfills'
,@sentry/utils
Sentry CLI Plugin: Command failed: /dility/node_modules/.pnpm/@sentry+cli@1.75.2_encoding@0.1.13/node_modules/@sentry/cli/sentry-cli releases new qocVBIgiVuEmOR8MUS5Ey 16.79 /dility/node_modules/.pnpm/@sentry+cli@1.75.2_encoding@0.1.13/node_modules/@sentry/cli/sentry-cli: 2: Syntax error: "(" unexpected
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:
Expected Result
Getting my app deployed
Actual Result
My app is crashing with this error:
Sentry CLI Plugin: Command failed: /dility/node_modules/.pnpm/@sentry+cli@1.75.2_encoding@0.1.13/node_modules/@sentry/cli/sentry-cli releases new qocVBIgiVuEmOR8MUS5Ey 16.79 /dility/node_modules/.pnpm/@sentry+cli@1.75.2_encoding@0.1.13/node_modules/@sentry/cli/sentry-cli: 2: Syntax error: "(" unexpected