-
-
Notifications
You must be signed in to change notification settings - Fork 9
Error: Cannot find module '/.next/server/app/(account)/binaries/sentry_cpu_profiler-v93-darwin-arm64.node' #141
Comments
Also tried: yarn add @sentry/node @sentry/profiling-node Still same error. |
Should add, this is next 13 and the error seems odd that it's looking for binary actually in my /app folder. (account) as shown above is just a next 13 pattern for organizing files that don't impact the url. |
Hmm, @tholder, it definitely should not look for the binary there. How are you initializing the Sentry SDK? Mind sharing the full error stack trace btw |
I just ran through the next setup with the automated setup. The profiling I setup exactly as shown when you go to the profiling page and click 'Set Up Profiling'. See: Full stack trace here: Error: Cannot find module '/Users/tholder/Documents/boardshape/boardshape/.next/server/app/(account)/binaries/sentry_cpu_profiler-v93-darwin-arm64.node'
at webpackEmptyContext(app:///Users/tholder/Documents/boardshape/boardshape/.next/server/app/(account)/agendas/page.js:22:10)
at importCppBindingsModule(webpack-internal:///(sc_server)/./node_modules/@sentry/profiling-node/lib/cpu_profiler.js:22:95)
at eval(webpack-internal:///(sc_server)/./node_modules/@sentry/profiling-node/lib/cpu_profiler.js:30:25)
at Object.(sc_server)/./node_modules/@sentry/profiling-node/lib/cpu_profiler.js (file:///Users/tholder/Documents/boardshape/boardshape/.next/server/app/(account)/agendas/page.js:4455:1)
at __webpack_require__(app:///Users/tholder/Documents/boardshape/boardshape/.next/server/webpack-runtime.js:33:43)
at eval(webpack-internal:///(sc_server)/./node_modules/@sentry/profiling-node/lib/hubextensions.js:8:24)
at Object.(sc_server)/./node_modules/@sentry/profiling-node/lib/hubextensions.js (file:///Users/tholder/Documents/boardshape/boardshape/.next/server/app/(account)/agendas/page.js:4477:1)
at __webpack_require__(app:///Users/tholder/Documents/boardshape/boardshape/.next/server/webpack-runtime.js:33:43)
at eval(webpack-internal:///(sc_server)/./node_modules/@sentry/profiling-node/lib/integration.js:8:25)
at Object.(sc_server)/./node_modules/@sentry/profiling-node/lib/integration.js (file:///Users/tholder/Documents/boardshape/boardshape/.next/server/app/(account)/agendas/page.js:4499:1) |
Interestingly I see it says 'We've received this project's first profile' but nothing shows up on the page. We are running next 13.3.0 - there is a newer version as of today I think which is mean to be production ready so I'll upgrade and try again. |
same here but with serverless
|
@marcoturi is your action bundled by any chance? |
yes @JonasBa it is, through https://github.com/floydspace/serverless-esbuild if you need I can share my build configuration |
Ah yes @marcoturi, I suspect the binary might not correctly be copied over to the correct location. Can you confirm if you are seeing the binary as part of the final bundle? |
@marcoturi I just had a look at how this is handled in other packages that deal with native bindings (sharp came to mind). It seems they expect you to make the package as external, do you mind testing that and telling me if it works? |
@JonasBa
Two downside that I can notice now:
|
Good you got it sorted but I think whether profiler is a worthwhile addition for you isn't really relevant to this issue. I still don't have a solution for the original issue which is with next 13. As Next 13 uses turbopack I'm not yet sure how to apply the same fix. |
@tholder yeah, sorry we should have moved this into a separate issue, I just wasn't sure if it might be of similar nature - I will need to test how turbopack handles this, likely sometime next week. @marcoturi glad you got it working. Just to address your points:
A large majority of these are unused binaries, it should not significantly impact cold start, but please do let me know if it does. In the future we will bundle all library code so you only end up with a single executable (+ the binaries)
I can see the flamegraph doesn't show much data, might need a few transactions to become more useful as it's aggregated data. If you click on one of the recent profiles in the 2nd table below the flamegraph, is the data there more actionable? In order to not pollute this issue any further, mind just taking this to email? Feel free to send me an email to [email protected] or [email protected] and we can tackle everything there. |
@tholder Just to get some extra info, are you using nextjs 13.4 or any of the other minor versions (if so, which one)? |
The error occurred on 13.3 but I have since upgraded to 13.4. I'll try re-installing with this version next week. |
@tholder ok, I will investigate this. Will be doing a lot of SDK work next week and will try tackle this as well. We have users on nextjs who use profiling, I'm just not sure what version they are running. I will test the turbopack setup and update with what I find |
I have same issue with solito monorepo (including nextjs app - v13.0.7, node - v16.14.2): |
@fundlg since we use dynamic require based on arch and platform, bundlers determine the static set of files they need to move, this means the binary file is never moved and the MODULE_NOT_FOUND error is correctly thrown. I'm going to be investigating this issue today, one possible solution seems to be to just enumerate all possible supported platforms which is probably what I will do, I just need to validate that it actually fixes this bug in the commonly used bundlers. |
Thanks! Will wait for updates |
Ok, so I reworked the binary loading here so that it can be properly enumerated by bundlers (confirmed with esbuild and webpack) and copied to outdir. PR was merged as esbuild and webpack are both stable bundlers - will look into turbopack now. |
@fundlg and @tholder my current fix only fixes the situation for platforms that we provide prebuilt binaries for (darwin is currently compiled from source). I'm going to look into adding this in CI as github runners are now in beta, once that is done, they should be automatically picked up and moved to the dest folder. Sorry for the long turnaround, I know this is annoying for you to wait for, but it requires me to move quite a few things around and test. |
Github actions struggling during these past two days has also been a nice source of frustration 😭 |
@fundlg @tholder, since gh is having issues, do you mind running I just created a sample next ^13.4.1" project using node 16.16 on M1 and after adding npm i @sentry/profiling-node and running |
@JonasBa hey, I've tried to install package with Thanks! |
@fundlg yes, you python3 is required by node-gyp so that we can compile the binary from source. The env variable with path to the correct binary should not be necessary though, do you still get the same error if you do not set the env variable? |
I have encountered the same exact issue and tried the following, but the error persists:
I then tried to run
I am running on a Macbook Air (2015) with MacOs BigSur installed. |
@JonasBa Yes, I have it installed locally. Looks like I had to provide env variable in
|
Receive similar with the latest nextjs 13.4.4 on Windows as-well (standalone mode) (next dev, build) |
I'm going to investigate this. My best guess is that postinstall silently fails here and we don't see the binding compile errors |
Similar trying to install on ubuntu 22.
|
Happening in GH action since upgrading version:
|
Can someone please test if removing yarn.lock or package-lock.json and running npm install resolves the issue? This seems very similar to the issue described here. Additionally, can someone share what version of npm you are running by doing |
Can confirm that removing the lock file does fix the issue but only temporarily. As soon as CI tries to re-run it comes up with the error again. |
@Llanilek would you mind testing 1.0.4 - I changed to run the compile check during install vs postinstall phase. |
@JonasBa I'll give it a whirl shortly. We had to remove profiling temporarily as it was blocking our deployment and we needed to get something out quick. I'll load it back up again later and give it a whirl. |
Has anyone tested this recently? It should be fixed since the last version and I haven't seen any new reports coming about this issue |
I just tested this. Error remains. npm config get ignore-scripts --global next 13.4.7 (latest) npm install --verbose --foreground-scripts @sentry/profiling-node Seems okay. Only one error: install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-darwin-unknown-arm64.tar.gz Proceeds to build from source. I then get a lot of linker warnings: ld: warning: dylib (/opt/homebrew/XXXX/YYYY/VERSION/lib/libZZZZ.dylib) was built for newer macOS version (12.0) than being linked (11.0). Finally: "Some issues need review, and may require choosing a different dependency." |
Somehow, the required build scripts are not run. I have come up with a quick workaround: npm i @sentry/profiling-node The library will now be compiled for the arm64 architecture and copied to the destination. Your project should subsequently be able to find the library and build successfully. @JonasBa: This workaround could provide directions for correcting the build scripts. For further investigation take a look at: node_modules/@sentry/profiling-node/package.json There are some potentially related issues that could hopefully be solved together: |
i have, same issue on 1.0.7. |
Can confirm that this works. Creating the binary if it is not the list of precompiled binaries, ty @jl75. |
We've released 1.0.8 and some folks internally at Sentry who had issues with this have said that the release resolved it for them. Do you mind upgrading and letting me know if this still happens? |
That said, I am currently looking at providing prebuilt binaries for darwin/arm64. I suspect none of you run prod system on these. It's a small win, but I would like to save everyone the headache of installing build tooling and having to recompile from source when you install the package. |
I was having a similar issue with dlopen on m1 MAC (Ventura 13.5_, the error I was seeing was "not a mach-o file" for the cpu profiler binary. The problem was the python version (3.11.2), after I switched to 3.10.12 and reinstalled/rebuilt the binary it worked. |
Have the same issue with NextJs 13 and profiler. "@sentry/node": "^7.63.0", I build it in Docker with "node:18-alpine"
|
@AmirL this is a different issue - you need to configure a .node loader for your application. I will close this issue as binaries should now be prebuild and available. If you are seeing a Tldr, but for esbuild you will need to add
and for webpack, you will need https://webpack.js.org/loaders/node-loader/. @stafflink-hrishi your issue seems different than the original issue described (I will create a new issue) |
@JonasBa Can it be added to the Sentry setup manual for NextJs? |
Hi guys. I have the same issue. As I understand the last version of sentry Another strange thing that I can swith to 21 version of node via nvm, build it and run app. |
Same issue when enabling sentry with NestJS on windows |
@sheyDev what version of node are using? @OliverMax It's not that it is incompatible, it's just that we do not build binaries for it. If you install the tooling, you can still compile and run the binaries yourself |
Not sheyDev, but I am also running into the same problem on Windows: Windows:
Node:
package.json:
Stacktrace:
Sure enough, when I look in
|
@JonasBa I'm using v21.7.2 |
@sheyDev, we do not support non LTS (odd) node versions, so you will either have to downgrade to v20, build the binaries yourself (cd to installed package directory and run build:bindings:configure and build:bindings) or wait for the upgrade to v22. I think there shouldnt be an issue in building from source. If you see, let us know and we can take a look |
For anyone using AWS CDK, had to add |
Is there an existing issue for this?
SDK Version
0.3.0
What environment is your node script running in?
Local dev using nvm node v18.15.0
Are you using an alpine based docker image?
Does the failure occur on a remote environment only?
Are you using alpine based node docker image. If so, what version are you using? e.g node:16-alpine3.12
No response
If you are using alpine, have you tried using latest version of alpine or (currently alpine3.16 or alpine3.17)?
Have you tried using the latest minor version of node (currently 16.20 or 18.15)?
If you run npm install --verbose --foreground-scripts @sentry/profiling-node in an empty directory, what is the output?
n.a
Crash report
On Apple M1 receive error:
error - Error: Cannot find module '/.next/server/app/(account)/binaries/sentry_cpu_profiler-v93-darwin-arm64.node
The text was updated successfully, but these errors were encountered: