Skip to content

Cannot find package .../@opentelemetry\semantic-conventions\index.js #16243

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

Closed
3 tasks done
skoenfaelt opened this issue May 9, 2025 · 9 comments
Closed
3 tasks done

Comments

@skoenfaelt
Copy link

skoenfaelt commented May 9, 2025

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/nuxt

SDK Version

9.17.0

Framework Version

3.17.2

Link to Sentry event

No response

Reproduction Example/SDK Setup

fresh install no custom config other than the self hosted server
https://github.com/skoenfaelt/sentry-deploy-bug/tree/main

Steps to Reproduce

  1. build your project with sentry setup
  2. open this folder path .output\server\node_modules\@sentry\node\node_modules\@opentelemetry\semantic-conventions
  3. 'index.js' is not present.

Full Error Log (hidden user path)
node:internal/modules/esm/resolve:215
const resolvedOption = FSLegacyMainResolve(packageJsonUrlString, packageConfig.main, baseStringified);
^

Error: Cannot find package '...\server\node_modules@sentry\node\node_modules@opentelemetry\semantic-conventions\index.js' imported from ...\server\node_modules@sentry\node\build\esm\integrations\tracing\koa.js
at legacyMainResolve (node:internal/modules/esm/resolve:215:26)
at packageResolve (node:internal/modules/esm/resolve:841:14)
at moduleResolve (node:internal/modules/esm/resolve:927:18)
at defaultResolve (node:internal/modules/esm/resolve:1169:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:542:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:510:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)
at ModuleWrap. (node:internal/modules/esm/module_job:96:40)
at link (node:internal/modules/esm/module_job:95:36) {
code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v20.18.0


"dependencies": {
    // ...
    "@sentry/nuxt": "^9.17.0",
    "nuxt": "^3.17.2",
    "vue": "^3.5.13",
    "vue-router": "^4.5.1"
  },
  "overrides": {
    "@vercel/nft": "^0.27.4"
  }

Expected Result

I assume that the website is loading.

Actual Result

The website is not loading, creating an error log.
If I run the proj build locally in my proj folder it runs. As soon as I copy the contents of the .output folder to my IIS its not working anymore. I assume its working locally because the whole node_modules are present.

I also have removed my node_modules folder and my bun.lock > fresh install without cache bun i --no-cache

could linked to #15628 (comment)

@skoenfaelt skoenfaelt added the Bug label May 9, 2025
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 9, 2025
@github-actions github-actions bot added the Nuxt label May 9, 2025
@s1gr1d
Copy link
Member

s1gr1d commented May 9, 2025

Hello, can you provide a small reproduction example?

And which package manager do you use?

@skoenfaelt
Copy link
Author

skoenfaelt commented May 9, 2025

Hello @s1gr1d

please checkout
https://github.com/skoenfaelt/sentry-deploy-bug/tree/main

In this example I use npm.
The proj context

  1. created a fresh nuxt app via npm create nuxt@latest
  2. npx @sentry/wizard@latest -i nuxt

I do not know how to create logs locally, but thats basically what I did with my real project.

in this example I expect at least the app to start. Sentry wont work, since you can not reach our self hosted url from outside.

!Important
please copy the contents of .output in a folder somewhere else than the proj folder and try to start the prod server. then the error will show immediatly

remove adjust the path (.output) according to your context.

node .output/server/index.mjs // official starter of prod server
node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs // from docs of sentry

Both start commands behave the same > error

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 9, 2025
@s1gr1d
Copy link
Member

s1gr1d commented May 9, 2025

Hello, thanks for the reproduction! I just tried it and was not able to reproduce the issue.

In the app directory of your server there is no node_modules folder, so remove it here locally to behave the same.

I read this comment in the readme of your reproduction and wanted to ask why you would remove the node_modules that are created in .output/server? Also without Sentry, the server would need those node_modules in order to work. Or do you have a special setup which includes bundling your server output?

@skoenfaelt
Copy link
Author

sorry for being unclear.

in dev mode, you will install your node_modules in your project.
then you start developing.

My reproduction of the readme was a bit unclear as i recognized it later. Forget deleting those dev node_modules. If you copy the .output folder somewhere else, desktop for example and you open the folder in a terminal, starting the prod server the error should occur.

If you start the prod server from the .output folder inside your project, then the server/.../node_modules will reference the node_modules from your project (npm i)
this is not the case in the real world. the prod server does not know our nodee_modules. Its correct to have the server/.../node_modules.

The issue is that there is no index.js in "server\node_modules@sentry\node\node_modules@opentelemetry\semantic-conventions\index.js"

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 9, 2025
@s1gr1d
Copy link
Member

s1gr1d commented May 9, 2025

So this error message is only occurring where you deploy your application?

Can you share more information about your deployment environment? Where do you deploy it and how do you build and run the project there?

@skoenfaelt
Copy link
Author

skoenfaelt commented May 9, 2025

If I start the prod server inside the project folder. No problem (i guess windows junction will reference the whole project node_moduels and not only those from the .output)

Currently I deploy that sentry test app manually.

  1. Copy that exact same .output folder (which works as said locally) to my server (IIS)
  2. Start IIS (http-plattform-handler is used https://nitro.build/deploy/providers/iis#using-iis-handler)
  3. Start the App

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
    </handlers>
    <httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\logs\node.log" startupTimeLimit="20" processPath="C:\Program Files\nodejs\node.exe" arguments=".\server\index.mjs">
      <environmentVariables>
        <environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
        <environmentVariable name="NODE_ENV" value="Production" />
      </environmentVariables>
    </httpPlatform>
  </system.webServer>
</configuration>

On Sentry Docs:
https://docs.sentry.io/platforms/javascript/guides/nuxt/

# Start your app after building your project with `nuxi build`
node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs

i did not use this command in local prod mode, i used node .output/server/index.mjs // official starter of prod server and that worked, i got reports in the sentry server.
I expect if I copy that stuff to my server, that it works the same.


Also with the adjusted command from docs its not working


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" requireAccess="Script" />
    </handlers>
    <httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\logs\node.log" startupTimeLimit="20" processPath="C:\Program Files\nodejs\node.exe" arguments="--import ./server/sentry.server.config.mjs ./server/index.mjs">
      <environmentVariables>
        <environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
        <environmentVariable name="NODE_ENV" value="Production" />
      </environmentVariables>
    </httpPlatform>
  </system.webServer>
</configuration>

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 9, 2025
@s1gr1d
Copy link
Member

s1gr1d commented May 9, 2025

Ah okay, so you want to build locally and then move the folder to IIS (and that without removing the .output/server/node_modules folder.

Now, I also moved the folder somewhere else and I was possible to run it without the error.
The node_modules include the index file:

drawing

But as this is a symlink, I checked the link target and it goes to this index file (which is also included inside node_modules):

drawing

And did I understand it right that your index file is missing here?
I'm also not quite sure why that should be the case 🤔 Especially as I cannot reproduce it with the provided reproduction.

@skoenfaelt
Copy link
Author

@s1gr1d thank you for you diving into this problem!

I tried a fresh installation on my private computer. same issue if you copy and paste the folder via windows context menu.
Since these files in .output/server/node_modules are symlinks I guess windumb can not copy their root files, because the process is too complex...
Bullsh*t ^^ i tried to copy it with powershell Copy-Item -Path ".output" -Destination "C:\Users\USERNAME\Documents\SentryDeploy" -Recurse

and this works.

Monday I will test this at the company, with the self hosted sentry. If this works with a copy powershell script, then I will close this issue. if this issue still perists I will ping you again, if its okay.

For now, enjoy your weekend!

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 9, 2025
@skoenfaelt
Copy link
Author

skoenfaelt commented May 9, 2025

Issue can be closed. Totally my fault by copy the demo app via windows copy/paste

Solved by Copy-Item -Path "src" -Destination "dest" -Recurse to copy the prod build of the demo app with its root symlink files from the server/node_modules folder.

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

No branches or pull requests

2 participants