Repository navigation
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
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
- following up the automatically setup from sentry.io in the webapp.
- implement docker to deploy the app
- use docker compose
- the app first crashes getting the error
Module not found: Can't resolve '@sentry/utils/esm/buildPolyfills', - then I install
@sentry/utils - the app crashes again getting the 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 - adding
RUN pnpm add @sentry/cliin 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/@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
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsWaiting for: Community
Activity
lforst commentedon Oct 30, 2023
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:
in you next.config.js. Note that this will prevent source maps from being uploaded.
getsantry commentedon Nov 21, 2023
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 🥀
SanderCokart commentedon Feb 9, 2024
Have you fixed this issue yet? Running into the same issue.
fimbres commentedon Feb 9, 2024
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 crashesSanderCokart commentedon Feb 9, 2024
I FIGURED IT OUT.
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:
Question
It responsed with:
Answer
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-certificatesDisable 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.
Final Dockerfile
Final docker-compose.yml