Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment failing because of missing optional dependencies #2319

Open
1 of 8 tasks
Strernd opened this issue Dec 17, 2024 · 6 comments
Open
1 of 8 tasks

Deployment failing because of missing optional dependencies #2319

Strernd opened this issue Dec 17, 2024 · 6 comments

Comments

@Strernd
Copy link

Strernd commented Dec 17, 2024

CLI Version

2.39.1

Operating System and Architecture

  • macOS (arm64)
  • macOS (x86_64)
  • Linux (i686)
  • Linux (x86_64)
  • Linux (armv7)
  • Linux (aarch64)
  • Windows (i686)
  • Windows (x86_64)

Operating System Version

Amazon Linux 2023

Link to reproduction repository

No response

CLI Command

No response

Exact Reproduction Steps

Since we setup Sentry for our Next.js Frontend and went through the wizard that setups source maps almost all of our deployments are failing because of

It seems like none of the "@sentry/cli" package's optional dependencies got installed. Please make sure your package manager is configured to install optional dependencies. If you are using npm to install your dependencies, please don't set the "--no-optional", "--ignore-optional", or "--omit=optional" flags. Sentry CLI needs the "optionalDependencies" feature in order to install its binary.

I get this error when

  • removing @sentry/cli from the dependencies
  • moving @sentry/cli to dev dependencies
  • most of the times when just plainly installed with npm i @sentry/cli - When I add a new PR, and @sentry/cli is still in the dependencies it will fail. If I run npm i @sentry/cli again and commit it sometimes fixes it.

The behavior seems very flaky and I have no clue why.

After researching and trying for 2 hours to find a workaround or fix I give up and raise this as a bug.

We are deploying this on Vercel. This seems to be related to this issue: #1849

Expected Results

@sentry/cli doesn't cause the build to fail

Actual Results

@sentry/cli causes the build to fail

Logs

/

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 17, 2024
@knd775
Copy link

knd775 commented Dec 17, 2024

Can you provide your package.json? That would be a helpful starting point.

@Strernd
Copy link
Author

Strernd commented Dec 18, 2024

I think the problem comes from running npm i after a checkout. That seems to remove the optional dependencies which then change the package-lock.json and get committed.

So what's happening

  1. Checkout
  2. npm i - package.json stays the same, package-lock.json changes (rm optional dependencies)
  3. npm i @sentry/cli - package.json unchanged, package-lock.json added optional dependencies

Not being able to use the default npm i with this package is a problem.

Package json

 "dependencies": {
    "@1password/op-js": "^0.1.13",
    "@ag-grid-community/client-side-row-model": "^32.3.3",
    "@ag-grid-community/react": "^32.3.3",
    "@ag-grid-community/styles": "^32.3.3",
    "@ag-grid-community/theming": "^32.3.3",
    "@ag-grid-enterprise/column-tool-panel": "^32.3.3",
    "@ag-grid-enterprise/core": "^32.3.3",
    "@ag-grid-enterprise/excel-export": "^32.3.3",
    "@ag-grid-enterprise/filter-tool-panel": "^32.3.3",
    "@ag-grid-enterprise/menu": "^32.3.3",
    "@ag-grid-enterprise/range-selection": "^32.3.3",
    "@ag-grid-enterprise/row-grouping": "^32.3.3",
    "@ag-grid-enterprise/set-filter": "^32.3.3",
    "@ag-grid-enterprise/status-bar": "^32.3.3",
    "@ag-grid-enterprise/viewport-row-model": "^32.3.3",
    "@auth0/nextjs-auth0": "^3.5.0",
    "@aws-sdk/client-s3": "^3.485.0",
    "@aws-sdk/s3-request-presigner": "^3.485.0",
    "@emotion/react": "^11.11.0",
    "@emotion/styled": "^11.11.0",
    "@faker-js/faker": "^9.0.3",
    "@headlessui/react": "^1.7.15",
    "@hello-pangea/dnd": "^16.3.0",
    "@langchain/core": "^0.3.19",
    "@langchain/langgraph": "^0.2.22",
    "@mui/material": "^6.1.0",
    "@mui/styled-engine-sc": "^5.12.0",
    "@mui/x-data-grid": "^7.7.1",
    "@radix-ui/react-alert-dialog": "^1.1.2",
    "@radix-ui/react-aspect-ratio": "^1.1.0",
    "@radix-ui/react-collapsible": "^1.1.1",
    "@radix-ui/react-dialog": "^1.1.2",
    "@radix-ui/react-hover-card": "^1.1.2",
    "@radix-ui/react-label": "^2.1.0",
    "@radix-ui/react-popover": "^1.1.2",
    "@radix-ui/react-scroll-area": "^1.2.0",
    "@radix-ui/react-select": "^2.1.2",
    "@radix-ui/react-slider": "^1.2.1",
    "@radix-ui/react-slot": "^1.1.0",
    "@radix-ui/react-switch": "^1.1.1",
    "@radix-ui/react-tabs": "^1.1.1",
    "@radix-ui/react-toggle": "^1.1.0",
    "@radix-ui/react-toggle-group": "^1.1.0",
    "@radix-ui/react-tooltip": "^1.1.3",
    "@radix-ui/react-visually-hidden": "^1.1.0",
    "@react-pdf/renderer": "^3.1.17",
    "@reduxjs/toolkit": "^1.9.5",
    "@sentry/cli": "^2.39.1",
    "@sentry/nextjs": "^8.42.0",
    "@tailwindcss/forms": "^0.5.3",
    "@tanstack/react-query": "^5.61.0",
    "@types/node": "18.16.3",
    "@types/react": "18.2.8",
    "@types/react-dom": "18.2.3",
    "ai": "^4.0.6",
    "async-mutex": "^0.5.0",
    "auth0": "^4.15.0",
    "autoprefixer": "10.4.14",
    "chart.js": "^4.3.0",
    "chartjs-plugin-annotation": "^3.0.0",
    "class-variance-authority": "^0.7.0",
    "classnames": "^2.5.1",
    "clsx": "^2.1.1",
    "cmdk": "^1.0.0",
    "commander": "^12.1.0",
    "date-fns": "^3.6.0",
    "dayjs": "^1.11.13",
    "dotenv": "^16.4.5",
    "drizzle-orm": "^0.34.1",
    "esbuild": "^0.23.1",
    "eslint": "8.39.0",
    "eslint-config-next": "13.3.4",
    "langchain": "^0.3.6",
    "lodash": "^4.17.21",
    "lucide-react": "^0.447.0",
    "moment": "^2.29.4",
    "next": "^14.2.15",
    "next-redux-wrapper": "^8.1.0",
    "next-themes": "^0.3.0",
    "pg": "^8.13.0",
    "postcss": "8.4.23",
    "posthog-js": "^1.167.0",
    "react": "18.2.0",
    "react-beautiful-dnd": "^13.1.1",
    "react-chartjs-2": "^5.2.0",
    "react-day-picker": "^8.10.1",
    "react-dom": "18.2.0",
    "react-markdown": "^9.0.1",
    "react-redux": "^8.0.7",
    "recharts": "^2.14.1",
    "remark-gfm": "^4.0.0",
    "sass": "^1.77.6",
    "sonner": "^1.5.0",
    "styled-components": "^5.3.10",
    "swr": "^2.1.5",
    "tailwind-merge": "^2.5.2",
    "tailwindcss": "^3.4.14",
    "tailwindcss-animate": "^1.0.7",
    "tailwindcss-motion": "^0.4.3-beta",
    "ts-node": "^10.9.2",
    "typeorm": "^0.3.20",
    "typescript": "5.1.3",
    "vaul": "^1.1.1",
    "xlsx": "^0.18.5",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@mui/x-date-pickers": "^7.17.0",
    "@types/lodash": "^4.14.195",
    "@types/papaparse": "^5.3.7",
    "@types/pg": "^8.11.10",
    "@types/react-beautiful-dnd": "^13.1.7",
    "drizzle-kit": "^0.25.0",
    "husky": "^8.0.3",
    "tsx": "^4.19.1"
  }

@knd775
Copy link

knd775 commented Dec 18, 2024

You shouldn't need to have the cli as a direct dependency. Try removing it from your packages.json.

@chargome
Copy link
Member

chargome commented Dec 18, 2024

@Strernd are you specifically choosing to upload sourcemaps via cli or why do you have it listed in your package.json? Because the @sentry/nexjs SDK ships with automatic sourcemap uploads using https://www.npmjs.com/package/@sentry/webpack-plugin (which includes the cli).

@Strernd
Copy link
Author

Strernd commented Dec 19, 2024

@knd775 If I remove it, the error still persists, as stated in my original post.
@chargome I have onboarded our project to Sentry with the wizard. If I remember correctly I had to run it twice, because after the initial setup Sentry reported that sourcemaps are there but cannot be associated with the code for some reason.

If it is possible to upload the source maps in another way that removes the dependency I'm very much interested in doing so, but I followed Sentrys standardized onboarding tool for Next.js projects.

If the Sentry wizard is not the recommended way to setup a Next.js project I'd like to know which guide to follow.

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 19, 2024
@chargome
Copy link
Member

Got it. The wizard is the recommended way, it will setup sourcemaps uploads with the webpack plugin which has a dependency on sentry-cli – you should not need @sentry/cli listed in your dependencies. Could you try removing it and re-creating your lockfile? Seems like something in your setup is preventing optional deps to be installed. Is the build only failing on vercel?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

4 participants