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

@sentry/vite-plugin build fails when invoking sentry-debug-id-upload-plugin #414

Closed
ThorntonStuart opened this issue Oct 4, 2023 · 7 comments

Comments

@ThorntonStuart
Copy link

Environment

  • Running as Docker image
  • vite: 4.4.9
  • @sentry/vite-plugin: 2.7.1

Other plugins:

  • laravel-vite-plugin: 0.8.0
  • @vitejs/plugin-vue: 4.3.1

Steps to Reproduce

vite.config.js

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import 'dotenv/config';
import { resolve } from 'node:path';
import copy from 'rollup-plugin-copy';
import checker from 'vite-plugin-checker';
import { sentryVitePlugin } from '@sentry/vite-plugin';

export default ({ mode }) => defineConfig({
  build: {
    sourcemap: true,
  },
  plugins: [
    laravel({
      input: [
        'resources/js/app.js',
        'resources/js/inertia.js',
        'resources/css/app.css',
      ],
      ssr: 'resources/js/ssr.js',
      refresh: true,
      ...(mode !== 'production' && { valetTls: process.env.APP_URL.split('//')[1] }),
    }),
    vue({
      template: {
        transformAssetUrls: {
          base: null,
          includeAbsolute: false,
        },
      },
    }),
    copy({
      targets: [
        {
          src: 'resources/images/*',
          dest: 'public/img',
        },
      ],
    }),
    checker({ vueTsc: true }),
    sentryVitePlugin({
      authToken: process.env.VITE_SENTRY_AUTH_TOKEN,
      org: 'acme',
      project: 'acme-project',
      debug: true,
      release: {
        name: `acme@4.4.9`,
        uploadLegacySourcemaps: {
          paths: ['./public/build/assets', './bootstrap/ssr/assets'],
          ext: ['js', 'mjs'],
        }
      }
    })
  ],
});

Dockerfile

FROM node:lts-alpine AS builder

RUN npm config set ignore-scripts false

RUN apk update && apk add git

WORKDIR /app

COPY package*.json ./

RUN npm install

RUN ./node_modules/.bin/sentry-cli --help

COPY ./ /app

COPY --from=composer /app/vendor /app/vendor

RUN npm run build

Expected Result

Successful build. Running with npm config set ignore-scripts false (noticed from other issues that this can sometimes be a problem). Added debug steps - ./node_modules/.bin/sentry-cli --help has verified that the CLI has installed in the post-install steps by outputting help options. Running outside of container completes successful build.

Actual Result

#21 111.8 [sentry-vite-plugin] Info: Using environment variables configured in ".env.sentry-build-plugin".
#21 112.7 vite v4.4.9 building for production...
#21 114.0 [sentry-vite-plugin] Info: Sending error and performance telemetry data to Sentry. To disable telemetry, set `options.telemetry` to `false`.
#21 114.5 transforming...
#21 217.1 [plugin:vite:resolve] Module "crypto" has been externalized for browser compatibility, imported by "/app/node_modules/meilisearch/dist/bundles/meilisearch.esm.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
#21 252.1 ✓ 7360 modules transformed.
#21 265.7 rendering chunks...
#21 284.8 computing gzip size...
#21 285.9 [sentry-vite-plugin] Debug: No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.
#21 287.7 [sentry-debug-id-upload-plugin] spawn Unknown system error -8
#21 287.7 ✓ built in 2m 55s
#21 287.7 error during build:
#21 287.7 Error: spawn Unknown system error -8
#21 287.7     at ChildProcess.spawn (node:internal/child_process:414:11)
#21 287.7     at spawn (node:child_process:761:9)
#21 287.7     at Object.execFile (node:child_process:351:17)
#21 287.7     at /app/node_modules/@sentry/cli/js/helper.js:198:20
#21 287.7     at new Promise (<anonymous>)
#21 287.7     at Object.execute (/app/node_modules/@sentry/cli/js/helper.js:186:10)
#21 287.7     at Releases.execute (/app/node_modules/@sentry/cli/js/releases/index.js:262:19)
#21 287.7     at Releases.new (/app/node_modules/@sentry/cli/js/releases/index.js:55:17)
#21 287.7     at _callee$ (/app/node_modules/@sentry/bundler-plugin-core/dist/cjs/index.js:1210:49)
#21 287.7     at tryCatch (/app/node_modules/@sentry/bundler-plugin-core/dist/cjs/index.js:115:17)
#21 ERROR: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Oct 4, 2023
@lforst
Copy link
Member

lforst commented Oct 4, 2023

@ThorntonStuart Hm. Can you verify that the CLI binary is executable? (check permissions and so on) Thanks!

@ThorntonStuart
Copy link
Author

@lforst added this to the container to try to check and still encountering the issue

#18 [builder  7/11] RUN chmod 777 ./node_modules/@sentry/cli/bin/sentry-cli
#18 DONE 0.6s

#19 [builder  8/11] RUN ls -lsa ./node_modules/@sentry/cli/bin
#19 0.294 total 20
#19 0.297      8 drwxr-xr-x    1 root     root          4096 Oct  5 08:46 .
#19 0.297      8 drwxr-xr-x    1 root     root          4096 Oct  5 08:47 ..
#19 0.297      4 -rwxrwxrwx    1 root     root           487 Oct  5 08:46 sentry-cli
#19 DONE 0.3s

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Oct 5, 2023
@lforst
Copy link
Member

lforst commented Oct 6, 2023

@ThorntonStuart ok so theres @sentry/cli/bin/sentry-cli and @sentry/cli/sentry-cli. The latter is the actual binary which is downloaded in the postinstall script. Can you check whether that one is available and executable? Thanks!

@getsantry getsantry bot removed the status in GitHub Issues with 👀 Oct 6, 2023
@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 Oct 6, 2023
@ThorntonStuart
Copy link
Author

ThorntonStuart commented Oct 6, 2023

Ah I see, thank you. Added the following - the first permissions structure mirrors my local setup in which I am able to run through the entire build process without issue. The CLI seems to be executable on install anyway:

#18 [builder  7/10] RUN ls -lsa ./node_modules/@sentry/cli
#18 0.124 total 27080
#18 0.127      8 drwxr-xr-x    1 root     root          4096 Oct  6 14:02 .
#18 0.127      8 drwxr-xr-x    1 root     root          4096 Oct  6 14:01 ..
#18 0.127      4 -rw-r--r--    1 root     root          1528 Oct  6 14:01 LICENSE
#18 0.127      8 -rw-r--r--    1 root     root          5975 Oct  6 14:01 README.md
#18 0.127      4 drwxr-xr-x    1 root     root          4096 Oct  6 14:01 bin
#18 0.127      4 -rw-r--r--    1 root     root           814 Oct  6 14:01 checksums.txt
#18 0.127      8 drwxr-xr-x    1 root     root          4096 Oct  6 14:01 js
#18 0.127      4 -rw-r--r--    1 root     root          1633 Oct  6 14:01 package.json
#18 0.127      4 drwxr-xr-x    1 root     root          4096 Oct  6 14:01 scripts
#18 0.127  27028 -rwxr-xr-x    1 root     root      27673480 Oct  6 14:02 sentry-cli
#18 DONE 0.1s

#19 [builder  8/10] RUN chmod 777 ./node_modules/@sentry/cli/sentry-cli ./node_modules/@sentry/cli/bin/sentry-cli
#19 DONE 0.2s

#20 [builder  9/10] RUN ls -lsa ./node_modules/@sentry/cli
#20 0.129 total 27084
#20 0.133      8 drwxr-xr-x    1 root     root          4096 Oct  6 14:02 .
#20 0.133      8 drwxr-xr-x    1 root     root          4096 Oct  6 14:01 ..
#20 0.133      4 -rw-r--r--    1 root     root          1528 Oct  6 14:01 LICENSE
#20 0.133      8 -rw-r--r--    1 root     root          5975 Oct  6 14:01 README.md
#20 0.133      8 drwxr-xr-x    1 root     root          4096 Oct  6 14:01 bin
#20 0.133      4 -rw-r--r--    1 root     root           814 Oct  6 14:01 checksums.txt
#20 0.133      8 drwxr-xr-x    1 root     root          4096 Oct  6 14:01 js
#20 0.133      4 -rw-r--r--    1 root     root          1633 Oct  6 14:01 package.json
#20 0.133      4 drwxr-xr-x    1 root     root          4096 Oct  6 14:01 scripts
#20 0.133  27028 -rwxrwxrwx    1 root     root      27673480 Oct  6 14:02 sentry-cli
#20 DONE 0.2s

Still getting the same error unfortunately. Only discernible change in output is that I can now see the file list with the computed gzip sizes before encountering the error however that is the same whether I alter CLI permissions or not:

#18 297.6 public/build/assets/Show-e5fd6e0a.js                                                           33.41 kB │ gzip:   9.54 kB │ map:    69.46 kB

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 Oct 6, 2023
@lforst
Copy link
Member

lforst commented Oct 9, 2023

Hm, we're reaching the point where I might be a bit lost. Can you try two more things:

  • Giving the docker build container more memory (I think with the -m flag)?
  • Using the non-alpine version of the image?

Thanks!

@ThorntonStuart
Copy link
Author

@lforst tried both of those to no avail unfortunately however after some further digging I found this issue on the CLI repo (getsentry/sentry-cli#1317) which seems to be the issue I'm having so just playing around with some of the recommended solutions on there. Happy to close this, thanks for your help!

@lforst
Copy link
Member

lforst commented Oct 10, 2023

@ThorntonStuart no need to close this if you feel like this is a proper issue. I am still confused as to why you might be getting the wrong binary since you are installing inside the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants