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

fix(baggage-span-processor): cannot find module #2260

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

longility
Copy link
Contributor

@longility longility commented Jun 6, 2024

Which problem is this PR solving?

Fixes the following error:

Error: Cannot find module '/Users/long/Repos/wise-rock/node_modules/@opentelemetry/baggage-span-processor/build/src/index.ts'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:415:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:665:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1034:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue (/Users/long/Repos/wise-rock/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._resolveFilename (/Users/long/Repos/wise-rock/node_modules/tsconfig-paths/src/register.ts:115:36)
    at Function.Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/Users/long/Repos/wise-rock/apps/api/src/tracing.ts:3:1)
    at Module._compile (node:internal/modules/cjs/loader:1241:14) {
  code: 'MODULE_NOT_FOUND',
  path: '/Users/long/Repos/wise-rock/node_modules/@opentelemetry/baggage-span-processor/package.json',
  requestPath: '@opentelemetry/baggage-span-processor'
}

To reproduce, create a solution with otel and reference BaggageSpanProcessor. Compiles successfully but blows up during runtime.

Short description of the changes

I looked at sibling packages and followed the same convention. I tested it locally by altering node_modules/@opentelemetry/baggage-span-processor directly to make sure it works. It worked after that.

Fixes the following error:
```
Error: Cannot find module '/Users/long/Repos/wise-rock/node_modules/@opentelemetry/baggage-span-processor/build/src/index.ts'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:415:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:665:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1034:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue (/Users/long/Repos/wise-rock/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._resolveFilename (/Users/long/Repos/wise-rock/node_modules/tsconfig-paths/src/register.ts:115:36)
    at Function.Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/Users/long/Repos/wise-rock/apps/api/src/tracing.ts:3:1)
    at Module._compile (node:internal/modules/cjs/loader:1241:14) {
  code: 'MODULE_NOT_FOUND',
  path: '/Users/long/Repos/wise-rock/node_modules/@opentelemetry/baggage-span-processor/package.json',
  requestPath: '@opentelemetry/baggage-span-processor'
}
```
Copy link

codecov bot commented Jun 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.03%. Comparing base (dfb2dff) to head (22e281f).
Report is 152 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2260      +/-   ##
==========================================
- Coverage   90.97%   90.03%   -0.94%     
==========================================
  Files         146      142       -4     
  Lines        7492     6917     -575     
  Branches     1502     1457      -45     
==========================================
- Hits         6816     6228     -588     
- Misses        676      689      +13     

see 58 files with indirect coverage changes

@AbhiPrasad
Copy link
Member

Whatever bundler test approach we end up adopting for open-telemetry/opentelemetry-js#4744 we should also then port to opentelemetry-js-contrib to catch issues like this.

@trentm trentm added the priority:p1 Bugs which cause problems in end-user applications such as crashes, data inconsistencies label Jun 6, 2024
@trentm trentm merged commit 6721bdd into open-telemetry:main Jun 6, 2024
19 of 20 checks passed
@dyladan dyladan mentioned this pull request Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p1 Bugs which cause problems in end-user applications such as crashes, data inconsistencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants