Closed ak-beam closed 1 year ago
@ak-beam this was a race condition in the build script that should be fixed in 1.0.6, do you mind upgrading to that version and seeing if it still fails?
Thanks so much
That did not fix it unfortunately
"node_modules/@sentry/profiling-node": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/@sentry/profiling-node/-/profiling-node-1.0.4.tgz",
- "integrity": "sha512-oIW3Cgcf0rkFT7R3h0Jqu+kjwlUc7Bg0MTsLL4DWyOHtly6vDZaHiinW2gjAD8+OyJDRfbvIMzQnDXqb1zXx0A==",
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/@sentry/profiling-node/-/profiling-node-1.0.6.tgz",
+ "integrity": "sha512-MFp9TGLyUe16zijnCMSgjzzyT2TJtP3AXNCClkHYQxLwYHvChCNM1zOK85dNR6OrU9qAH/18ezDfJyQrhIlW+A==",
"hasInstallScript": true,
Note that this did not happen on the pre-1.0.0 releases, and it works on x64 Linux hosts (GitHub Actions Docker)
same issue here
Hmm, I suspect the root of the issue here is. Are you by any chance including node_modules from the host machine? It should be ignored and node_modules should be freshly installed.
#0 91.52 npm ERR! node:internal/modules/cjs/loader:1310
#0 91.52 npm ERR! return process.dlopen(module, path.toNamespacedPath(filename));
I tried searching online and found and issue that appears to be of similar nature - https://github.com/kelektiv/node.bcrypt.js/issues/635
The recommendation is to make sure you add node_modules to .dockerignore so that installation is always fresh and to reinstall the package. Would you mind testing that for me and let me know if it works? Meanwhile I will try and reproduce this myself
Hmm, I suspect the root of the issue here is. Are you by any chance including node_modules from the host machine? It should be ignored and node_modules should be freshly installed.
No we are not. npm rebuild
only works if the install succeeds in the first place.
@JonasBa I can recreate this pretty easily with a Dockerfile that looks like this:
FROM node:18 AS build-env
WORKDIR /app
RUN npm install --save @sentry/node @sentry/profiling-node
It works correctly only on node:20
, looks like because on node:20
the precompiled binary works. The actual compilation seems to fail on ARM64 on anything under node:20
.
@ak-beam are you able to update your system to node:20
?
@ak-beam I remember reading about a breaking change that crept in between node .14 to .16 (https://github.com/microsoft/vscode/issues/178748#issuecomment-1499558639)... We prebuild binaries on .16 as the minor version, so this might be why the precompiled binaries are not working. If you pin the node version 18.16, does that solve the issue?
@ak-beam are you able to update your system to node:20?
No, we are on the LTS release.
If you pin the node version 18.16, does that solve the issue?
No, it still tries to compile.
node 18.16.0
does not seem to be installable anymore due to a CVE, only 18.16.1
works.
arm64 binaries are now provided, so this should no longer fail with this error. Feel free to reopen if it still occurs after installing the latest SDK version
I'm receiving that error running a Dockerfile with FROM node:20-alpine
And package.json with
"@sentry/node": "^7.93.0",
"@sentry/profiling-node": "^1.3.3",
Error:
=> [4/7] RUN npm install --production 74.6s
=> => # npm ERR! command failed
=> => # npm ERR! signal SIGSEGV
=> => # npm ERR! command sh -c node scripts/check-build.mjs
=> => # npm ERR! @sentry/profiling-node: Precompiled binary found, attempting to load /usr/src/app/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-x64-musl-115.node
=> => # npm ERR! @sentry/profiling-node: Precompiled binary found, skipping build from source.
=> => # npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-01-12T14_41_17_368Z-debug-0.log
Edit: updating to 1.3.5 seems to have fixed it
I'm having this issue randomly with php:8.2-fpm-alpine with alpine's nodejs apk
App's package.json contains
"@sentry/node": "^7.102.1",
"@sentry/profiling-node": "^7.102.1",
"@sentry/vite-plugin": "^2.14.2",
"@sentry/vue": "^7.102.1",
"@sentry/integrations": "^7.108.0",
Output is as below
npm ci npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead npm ERR! path /home/app/app/frontend-app/node_modules/@sentry/profiling-node npm ERR! command failed npm ERR! signal SIGSEGV npm ERR! command sh -c node scripts/check-build.js npm ERR! @sentry/profiling-node: Precompiled binary found, attempting to load /home/app/app/frontend-app/node_modules/@sentry/profiling-node/lib/sen try_cpu_profiler-linux-x64-musl-115.node npm ERR! @sentry/profiling-node: Precompiled binary found, skipping build from source. npm ERR! A complete log of this run can be found in: /home/app/.npm/_logs/2024-05-02T08_19_19_199Z-debug-0.log
In log file mentioned I can see following error messages:
3748 info run @sentry/profiling-node@7.109.0 install node_modules/@sentry/profiling-node node scripts/check-build.js 3749 info run @sentry/profiling-node@7.109.0 install { code: null, signal: 'SIGSEGV' } 3750 timing reify:rollback:createSparse Completed in 1880ms 3751 timing reify:rollback:retireShallow Completed in 0ms 3752 timing command:ci Completed in 32066ms 3753 verbose stack Error: command failed 3753 verbose stack at ChildProcess.
(/usr/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27) 3753 verbose stack at ChildProcess.emit (node:events:518:28) 3753 verbose stack at maybeClose (node:internal/child_process:1105:16) 3753 verbose stack at ChildProcess._handle.onexit (node:internal/child_process:305:5) 3754 verbose pkgid @sentry/profiling-node@7.109.0 3755 verbose cwd /home/app/app/frontend-app 3756 verbose Linux 5.4.274-1.el7.elrepo.x86_64 3757 verbose node v20.12.1 3758 verbose npm v10.2.5 3759 error path /home/app/app/frontend-app/node_modules/@sentry/profiling-node 3760 error command failed 3761 error signal SIGSEGV 3762 error command sh -c node scripts/check-build.js 3763 error @sentry/profiling-node: Precompiled binary found, attempting to load /home/app/app/frontend-app/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-x64-musl-115.node 3763 error @sentry/profiling-node: Precompiled binary found, skipping build from source. 3764 verbose exit 1 3765 timing npm Completed in 32422ms
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
SDK Version
"@sentry/node": "7.55.2", "@sentry/profiling-node": "1.0.4"
Link to Sentry event
No response
What environment is your node script running in?
Docker image: node:18.14.0 MacOS: 13.4 (22F66) Apple M1 Pro
How is your code deployed and bundled?
Local dev runs app within Docker w/ docker-compose
Dockerfile
Steps to Reproduce
npm install -D @sentry/profiling-node
to add package to projectnpm install
as a Docker stepExpected Result
NPM install finds prebuilt binary and succeeds
Actual Result
NPM Install Error
``` 0 105.1 npm ERR! code 1 #0 105.1 npm ERR! path /app/node_modules/@sentry/profiling-node #0 105.1 npm ERR! command failed #0 105.1 npm ERR! command sh -c node scripts/check-build.mjs #0 105.1 npm ERR! @sentry/profiling-node: Precompiled binary found, attempting to load... #0 105.1 npm ERR! @sentry/profiling-node: Precompiled binary found but failed loading #0 105.1 npm ERR! @sentry/profiling-node: Compiling from source... #0 105.1 npm ERR! gyp info it worked if it ends with ok #0 105.1 npm ERR! gyp info using node-gyp@9.4.0 #0 105.1 npm ERR! gyp info using node@18.14.0 | linux | arm64 #0 105.1 npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3" #0 105.1 npm ERR! gyp http GET https://nodejs.org/download/release/v18.14.0/node-v18.14.0-headers.tar.gz #0 105.1 npm ERR! gyp http 200 https://nodejs.org/download/release/v18.14.0/node-v18.14.0-headers.tar.gz #0 105.1 npm ERR! gyp http GET https://nodejs.org/download/release/v18.14.0/SHASUMS256.txt #0 105.1 npm ERR! gyp http 200 https://nodejs.org/download/release/v18.14.0/SHASUMS256.txt #0 105.1 npm ERR! gyp info spawn /usr/bin/python3 #0 105.1 npm ERR! gyp info spawn args [ #0 105.1 npm ERR! gyp info spawn args '/app/node_modules/node-gyp/gyp/gyp_main.py', #0 105.1 npm ERR! gyp info spawn args 'binding.gyp', #0 105.1 npm ERR! gyp info spawn args '-f', #0 105.1 npm ERR! gyp info spawn args 'make', #0 105.1 npm ERR! gyp info spawn args '-I', #0 105.1 npm ERR! gyp info spawn args '/app/node_modules/@sentry/profiling-node/build/config.gypi', #0 105.1 npm ERR! gyp info spawn args '-I', #0 105.1 npm ERR! gyp info spawn args '/app/node_modules/node-gyp/addon.gypi', #0 105.1 npm ERR! gyp info spawn args '-I', #0 105.1 npm ERR! gyp info spawn args '/root/.cache/node-gyp/18.14.0/include/node/common.gypi', #0 105.1 npm ERR! gyp info spawn args '-Dlibrary=shared_library', #0 105.1 npm ERR! gyp info spawn args '-Dvisibility=default', #0 105.1 npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/18.14.0', #0 105.1 npm ERR! gyp info spawn args '-Dnode_gyp_dir=/app/node_modules/node-gyp', #0 105.1 npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/18.14.0/<(target_arch)/node.lib', #0 105.1 npm ERR! gyp info spawn args '-Dmodule_root_dir=/app/node_modules/@sentry/profiling-node', #0 105.1 npm ERR! gyp info spawn args '-Dnode_engine=v8', #0 105.1 npm ERR! gyp info spawn args '--depth=.', #0 105.1 npm ERR! gyp info spawn args '--no-parallel', #0 105.1 npm ERR! gyp info spawn args '--generator-output', #0 105.1 npm ERR! gyp info spawn args 'build', #0 105.1 npm ERR! gyp info spawn args '-Goutput_dir=.' #0 105.1 npm ERR! gyp info spawn args ] #0 105.1 npm ERR! gyp info ok #0 105.1 npm ERR! gyp info it worked if it ends with ok #0 105.1 npm ERR! gyp info using node-gyp@9.4.0 #0 105.1 npm ERR! gyp info using node@18.14.0 | linux | arm64 #0 105.1 npm ERR! gyp info spawn make #0 105.1 npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] #0 105.1 npm ERR! gyp info ok #0 105.1 npm ERR! node:fs:1039 #0 105.1 npm ERR! handleErrorFromBinding(ctx); #0 105.1 npm ERR! ^ #0 105.1 npm ERR! #0 105.1 npm ERR! Error: ENOENT: no such file or directory, rename '/app/node_modules/@sentry/profiling-node/build/Release/sentry_cpu_profiler.node' -> '/app/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm64-glibc-108.node' #0 105.1 npm ERR! at Object.renameSync (node:fs:1039:3) #0 105.1 npm ERR! at file:///app/node_modules/@sentry/profiling-node/scripts/copy-target.mjs:18:4 #0 105.1 npm ERR! at ModuleJob.run (node:internal/modules/esm/module_job:194:25) { #0 105.1 npm ERR! errno: -2, #0 105.1 npm ERR! syscall: 'rename', #0 105.1 npm ERR! code: 'ENOENT', #0 105.1 npm ERR! path: '/app/node_modules/@sentry/profiling-node/build/Release/sentry_cpu_profiler.node', #0 105.1 npm ERR! dest: '/app/node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-linux-arm64-glibc-108.node' #0 105.1 npm ERR! } #0 105.1 npm ERR! #0 105.1 npm ERR! Node.js v18.14.0 #0 105.2 npm ERR! @sentry/profiling-node: Failed to build from source, please report this a bug at https://github.com/getsentry/profiling-node/issues/new?assignees=&labels=Type%3A+Bug&template=bug.yml ```